let solve n m = (n - 1) * (m - 1)

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

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