#include<iostream>
#include<algorithm>

using namespace std;
int t, n;
int cost[] = {0, 6000, 4000, 3000, 2000};
int main(){
 for(int i = 0;i < 4;i++){
  cin >> t >> n;
  cout << cost[t] * n << endl;
 }
 return 0;
}