let (>>=) xs f = List.map f xs |> List.concat
let ops = [("+", (+)); ("-", (-))]
let () =
  Scanf.scanf "%1d%1d%1d%1d" @@ fun a b c d ->
  ops >>= (fun (l0, (++)) ->
  ops >>= (fun (l1, (+-)) ->
  ops >>= (fun (l2, (+*)) ->
    if a ++ b +- c +* d = 7 then
      [Printf.sprintf "%d%s%d%s%d%s%d=7" a l0 b l1 c l2 d]
    else
      []
  ))) |> List.hd |> print_endline