(* O(1) *)
let get_coins a b i j =
  let buttons = Array.of_list [a; b] in
  let first = buttons.(i) in
  buttons.(i) <- first - 1;
  first + buttons.(j)

(* O(n) *)
let fold_int f a n =
  let rec fold f a i n =
    if i >= n then
      a
    else
      fold f (f a i) (i + 1) n
  in
    fold f a 0 n

(* O(1) *)
let solve a b =
  fold_int
    (fun sofar1 i ->
      fold_int
        (fun sofar2 j ->
          max sofar2 (get_coins a b i j))
        sofar1
        2)
    0
    2

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  match read_ints () with
  | [a; b] -> solve a b |> string_of_int |> print_endline
  | _ -> ()