#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
class Loan {
    private:
    string loanType;
    double amount;
    int years;
    public:
    Loan(string type, double amt, int yr){
        loanType = type;
        amount = amt;
        years = yr;
    }
    void calculateInterest(){
        if ((loanType != "home" && loanType != "personal") || amount < 0 || years < 1 || years > 30){
            cout << "Invalid input" << endl;
            return;
        }
        double rate = 0.0;
        if(loanType == "home")
        rate = 0.05;
        else if(loanType == "personal")
        rate = 0.10;
        double interest = amount * rate * years;
        cout << fixed << setprecision(2) << interest << endl;
    }
};
int main(){
    string loanType;
    double amount;
    int year;
    getline(cin, loanType);
    cin >> amount >>years;
    Loan loan(loanType, amount, years);
    loan.calculateInterest();
    return 0;
}