#include<iostream>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int val[5] = {0, 6000,4000,3000,2000};
	rep(i,4){
		int t, n;
		cin >> t >> n;
		cout << val[t]*n << endl;
	}
	return 0;
}