#include <iostream>

using namespace std;

int main()
{
	int P[4] = { 6000, 4000, 3000, 2000 };

	int t[4], n[4];

	for (int i = 0; i < 4; i++)
	{
		cin >> t[i] >> n[i];
	}

	for (int i = 0; i < 4; i++)
	{
		cout << P[t[i] - 1] * n[i] << endl;
	}

	return 0;
}