#include<iostream>
#include<iomanip>
using namespace std;
int main(){
    string a;
    int b;
    float c;
    cin>>a;
    cin>>b;
    cin>>c;
     if ( c <0 || (b !=0 && b!=1)){
         cout<<"Invalid input";
         return 0;
     }
     float d;
     if( a =="Basic"){
         d = 30.0;
     }
     else if( a == "Standard"){
         d = 50.0;
     }
     else if ( a == "Premium"){
         d = 80.0;
     }
     else{
         cout<<"Invalid input";
         return 0;
     }
     float tot = d*c;
     if(b== 1){
         tot *=0.80;
     }
     cout<<fixed<<setprecision(2)<<tot<endl;
     return 0;
}