#include <iostream>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)

int main(){
    int price[] = {0, 6000, 4000, 3000, 2000};
    REP(i, 4){
        int t, n;
        std::cin >> t >> n;
        std::cout << price[t] * n << std::endl;
    }
    return 0;
}