// editor1
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main() {
    string type;
    int discount;
    float months;
    cin>>type>>discount>>months;
    if(!(type=="Basic"&& type =="Standerd" && type=="Premium"))|| (discount!=0 && discount !=1)||months<=0||months>=10){
        cout<<"Invalid input";
        return 0;
    }
    float rate = (type=="Basic")? 30:(type == "Standerd" ? 50:80);
    if (discount) rate *=0.8;
    cout<<fixed<<setprecision(2)<<rate *months;
    }