#include<iostream>
using namespace std;
class Ticket
{
    private:
    string type;
    double basePrice;
    public:
    Ticket(string t, double price){
        type = t;
        basePrice = price;
    }
    void displayFinalPrice(){
        if(basePrice < 0){
            cout<< "Invalid input"<< endl;
            return;
        }
        double finalPrice = basePrice;
        if(type == "child" || type == "Child")
        finalPrice = basePrice * 0.8;
        else if(type == "senior" || type =="Senior")
        finalPrice = basePrice * 0.85;
        else if(type == "student" || type =="Student")
        finalPrice = basePrice * 0.9;
        else if(type == "adult" || type =="Adult")
        finalPrice = basePrice;
        //else{
        //    cout<<"Invalid input" << endl;
        //    return 0;
        //}
        cout << fixed << setprecision(0) << finalPrice <<endl;
        
    }
};
int main(){
    string type;
    double basePrice;
    getline(cin, type);
     cin >> basePrice;
     
    Ticket t(type, basePrice);
    t.displayfinalprice();
    return 0;
}