#encoding:utf-8 No.0277 2014.11.10
sale = Array.new
while gets
  sale.push gets.chomp.split.map{|elem| elem.to_i}
end

sale.each do |i|
  if i[0] == 1
    puts 6000*i[1]
  elsif i[0] == 2
    puts 4000*i[1]
  elsif i[0] == 3
    puts 3000*i[1]
  else i[0] == 4
    puts 2000*i[1]
  end
end