let x, y = Scanf.scanf " %d %d" @@ fun a b -> a, b
let _ = Printf.printf "%d\n" @@ List.fold_left (fun p r -> p + match r with 1 -> 300000 | 2 -> 200000 | 3 -> 100000 | _ -> 0) 0 [x; y] + if x = 1 && y = 1 then 400000 else 0