#include<iostream>                                                                                                                                      
using namespace std;                                                                                                                                    
                                                                                                                                                        
int main()                                                                                                                                              
{                                                                                                                                                       
  int t,n;                                                                                                                                              
  int price[]={0,6000,4000,3000,2000};                                                                                                                  
  for(;cin>>t>>n;)                                                                                                                                      
    {                                                                                                                                                   
      cout<<price[t]*n<<endl;                                                                                                                           
    }                                                                                                                                                   
}                                                                                                                                                       
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                                                                                                                        
                                                

Measured memory_bytes: 1160