let () =
  match List.fold_left
          (fun acc x -> match (acc, x) with
            | (x::y::acc, "+") -> (y + x) :: acc
            | (x::y::acc, "-") -> (y - x) :: acc
            | (x::y::acc, "*") -> (y * x) :: acc
            | (acc, n) -> (int_of_string n) :: acc)
          []
          (Str.split (Str.regexp " ") (read_line ())) with
  | [] -> assert false
  | ans :: _ -> Printf.printf "%d\n" ans