#include
using namespace std;
int main()
{
    double input;
    int count = 0;
    vector tmp;
    while(cin>>input)
    {
        tmp.push_back(input);
        count++;
        if(count==3)
        {
            if(input == tmp[1])
            {
                if(input == 11)
                {
                    tmp[0]*=0.7;
                }
                else if(input == 12)
                    tmp[0]*=0.8;
            }
        }
        else if(count==4) 
        {
            tmp[0]-=(50*input);
            tmp[0] = tmp[0]>0?tmp[0]:0;
        }
    }
    cout<<fixed<<setprecision(2)<<tmp[0]<<endl;
    return 0;
}