#include <bits/stdc++.h>
using namespace std;

int main() {
  int a[5] = {0, 6000, 4000, 3000, 2000};
  for (int i = 0; i < 4; ++i) {
    int t, n;
    cin >> t >> n;

    cout << n * a[t] << endl;
  }
}