#include<iostream>
using namespace std;
class loan{
    public:
    void home(double ant,int y){
        double n=(ant *5.8)/100.0;
        cout<<fixed<<setprecision(2)<<n*y<<endl;
    }
    void personal(double ant,int y){
        double n=(ant*10.0)/100.0;
        cout<<fixed<<setprecision(2)<<n*y<<endl;
        }
};
int main(){
    string s;
    cin<<s;
    double ant;
    int y;
    if(!(cin>>ant>>y)){
        cout<<"Invalid input";
        return 0;
    }
    if(ant<0||y<0||y>30){
        cout<<"Invalid input";
        return 0;
    }
    loan obj;
    if(s=="home"){
        obj.home(ant,y);
    }
    else if(s=="personal"){
        obj.personal(ant,y);
    }
    else {
        cout<<"Invalid input";
    }
    return 0;
}