#include <iostream>
using namespace std;

int main() {
    int type_class;
    double weight, cost;
    cin >> type_class >> weight;

    // Class: Economy 0; Business 2; VIP 3

    switch (type_class) {
        case 1:
            if (weight <= 25) {
                cout << "0";
            } else if (weight > 40) {
                cost = 2.00 * (weight - 40);
                cout << cost;
            } else {
                cost = 1.50 * (weight - 25);
                cout << cost;
            }
            break;
        case 2:
            if (weight <= 35) {
                cout << "0";
            } else if (weight > 50) {
                cost = 1.50 * (weight - 50);
                cout << cost;
            } else {
                cost = 1.25 * (weight - 35);
                cout << cost;
            }
            break;
        case 3:
            if (weight <= 60) {
                cout << "0";
            } else {
                cout << "30";
            }
            break;
        default:
            cout << "Wrong Input" << endl;
            break;
    }

    return 0;
}
