// editor2
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main(){
    string type;
    int discount;
    float months;
    getline(cin,type);
    cin>>discount>>months;
    
    double price= -1;
    if(type == "Basic")
    price=30.0;
    else if (type == "Standard")
    price = 50.0;
    else if(type == "Premium")
    price = 80.0;
    if(price<0||(discount != 0 && discount !=1)||months<0.0f){
        cout<<"Invalid input";
        return 0;
    }
    double total = price*months;
    if(discount==1)
    total*=0.80;
    cout<<fixed<<setprecision(2)<<total<<'';
    return 0;
}