#include<iostream>
#include<string>
using namespace std;
class Ticket
{
    string type;
    double basePrice;
public:
    Ticket(string t,double p){
        type=t;
        basePrice=p;
    }
    double calculateFinalPrice()
    {
        if(basePrice<0)
        {
            return -1;
        }
        if(type=="adult")
        {
            return basePrice;
        }
        else if(type=="child")
        {
            return basePrice*0.80;
        }
        else if(type=="senior")
        {
            return basePrice*0.85;
        }
        else if(type=="student")
        {
            return basePrice*0.90;
        }
        else
        {
            return -1;
        }
    }
};
    int main(){
        string ticketType;
        double basePrice;
        cin>>ticketType;
        cin>>basePrice;
        for(char&c:ticketType)
            c=tolower(c);
        Ticket t(ticketType,basePrice);
        double finalPrice=t.calculateFinalPrice();
        if(finalprice<0){
            cout<<"Invalid input";
        }
        else{
            cout<<finalprice;
            return 0;
        }
        
    }
}