#include <iostream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long code, quantity;
    if (cin >> code >> quantity) {
        if (code < 1 || code > 5 || quantity <= 0) {
            cout << "Invalid\n";
            return 0;
        }

        long long price = 0;
        if (code == 1) price = 50000;
        else if (code == 2) price = 80000;
        else if (code == 3) price = 60000;
        else if (code == 4) price = 70000;
        else if (code == 5) price = 40000;

        long long total = price * quantity;

        if (total >= 300000) {
            total = total * 90 / 100;
        } else if (total >= 150000) {
            total = total * 95 / 100;
        }

        cout << total << "\n";
    }

    return 0;
}