import Control.Monad

main :: IO ()
main = do
  ls <- replicateM 4 getLine
  mapM_ print $ solve (map (map read . words) ls)

solve :: [[Int]] -> [Int]
solve = map func 
  where
    func :: [Int] -> Int
    func [x,y]
      | x == 1 = y * 6000
      | x == 2 = y * 4000
      | x == 3 = y * 3000
      | otherwise = y * 2000