#include<stdio.h>
int main()
{
int S=6000,A=4000,B=3000,C=2000,a,b,i;
for(i=0;i<4;i++){
scanf("%d %d",&a,&b);
if(a==1){
S=S*b;
printf("%d\n",S);
}else if(a==2){
A=A*b;
printf("%d\n",A);
}else if(a==3){
B=B*b;
printf("%d\n",B);
}else if(a==4){
C=C*b;
printf("%d\n",C);
}
}
return(0);
}
