#include <iostream>
using namespace std;

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	for(int i = 0; i < 4; ++i){
		int t, n;
		cin >> t >> n;
		--t;
		cout << ticket[t] * n << endl;
	}

	return 0;
}