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

int tmp[] = {6000,4000,3000,2000};

int main(){
  int a,b;
  for(int i = 0;i < 4;i++){
    cin >> a >> b;
    cout << tmp[a-1] * b << endl;
  }

  return 0;
}



