#include <stdio.h>

int main(void){
    int price[]={0,6,4,3,2};
    int t, n;
    
    for (int i=0; i<4; i++){
        scanf("%d %d", &t, &n);
        printf("%d\n", price[t]*n*1000);
    }
    return 0;
}