#include<iostream>
#include<string>
using namespace std;
double calculateInterest(string loanType,double amount,int year){
    if(amount<-10000||amount>1000000||years<1||years>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 years;
    
    cin>>loanType>>amount>>years;
    double intrest =calculateInterest(loanType,amount,years);
    if(interest<0){
        cout<<"Invalid input"<<endl;
    }else{
        cout<<fixed<<setprecision(2)<<interest<<endl;
    }
    return 0;
}