Scanf.scanf "%d" @@ fun n ->
  let rec loop i l n =
    if i=4 then l else loop (i+1) (n mod 10::l) (n/10)
  in
  let ls = loop 0 [] n in
  let ls = List.fold_left (fun l d->
    match l with
    | [] -> [string_of_int d,d]
    | l -> List.fold_left (fun l (x,s) ->
            (Printf.sprintf "%s+%d" x d,s+d)::
            (Printf.sprintf "%s-%d" x d,s-d)::l
           ) [] l
    ) [] ls in
  ls |>List.iter (fun (s,d) -> if d=7 then (Printf.printf "%s=%d\n" s d; exit 0))

