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

const int T[] = {-1, 6000, 4000, 3000, 2000};

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