Scanf.scanf " %1d%1d%1d%1d" @@ fun a b c d ->
  let abcd = [|a; b; c; d|] in
  let n = 4 in
  let rec dfs acc ss i =
    if i >= n then
      if acc = 7 then (List.rev @@ "=7" :: ss |> String.concat "" |> print_endline; exit 0)
      else ()
    else
      let m = abcd.(i) in
      let f op = string_of_int m :: op :: ss in
      dfs (acc + m) (f "+") (i + 1);
      dfs (acc - m) (f "-") (i + 1) in
  dfs a [string_of_int a] 1