#include<iostream>
#include<string>
using namespace std;
double calculateIntrest(string loanType,double amount,int year){
    if(amount < -10000 || amount > 1000000 || year<1 || year>30 ||(loanType !="home" && loanType !="personal"))
    {
        return -1;
    }
    double rate=(loanType == "home")? 0.05:0.10;
    return amount * rate * year;
}
int main(){
    string loanType;
    double amount;
    int year;
    
    cin >> loanType >> amount >>year;
    double intrest = calculateIntrest(loanType,amount,year);
    if(interest < 0){
        cout<<"Invalid input"<<endl;
    }else{
        cout<< fixed << setprecision(2) << intrest << endl;
    }
    return 0;
}