let () =
  let f = function
      1 -> 6000
    | 2 -> 4000
    | 3 -> 3000
    | 4 -> 2000
    | _ -> 0
  in
  let rec read = function
      0 -> ()
    | i -> let (x,y) = Scanf.scanf " %d %d\n" (fun x y -> (x,y)) in
           Printf.printf "%d\n" ((f x)*y)
           ;read (i-1)
  in read 4
;;