#include<iostream>
using namespace std;

int main(void){
  int a,b;
  while(cin>>a>>b){
    switch(a){
    case 1:a=b*6000;break;
    case 2:a=b*4000;break;
    case 3:a=b*3000;break;
    case 4:a=b*2000;break;
  }
    cout<<a<<endl;
  }
  
}