#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	
	int d[4]={0};
	int r[4]={6000,4000,3000,2000};
	
	for(int i=0;i<4;i++){
		int a,b;
		cin>>a>>b;
		d[a-1]=b;
		cout<<d[a-1]*r[a-1]<<endl;
	}
	
	
	return 0;
}
