#include <iostream>

using namespace std;

int main() {
    int money[] = { 0, 6000, 4000, 3000, 2000 };
    int s, n;
    for (int i = 0; i < 4; i++) {
        cin >> s >> n;
        cout << money[s] * n << endl;
    }

    return 0;
}