data = Array.new(4)
i = 0
 
#p data
=begin
 
File.open("test/0277","r") do |input|
    while data[i] = input.gets do
        #p data[i]
        i += 1
    end
end
=end
 
 
    while data[i] = gets do
        #p data[i]
        i += 1
    end
 
     
for i in data
    if i == nil 
        break
    end
    a,b = (i.chomp).split(" ").map(&:to_i)
 
    case a 
    when 1 
        a = 6000
    when 2
        a = 4000
    when 3
        a = 3000
    when 4
        a = 2000
    end
    p a*b
end