open Buffer;;
let n = 4 in
let abcd = Array.init n @@ fun _ -> Scanf.scanf " %1d" @@ (+) 0 in
let b = create 0 in
for i = 0 to 1 lsl (n - 1) - 1 do
  let sum = ref abcd.(0) in
  clear b;
  add_char b @@ char_of_int @@ 48 + abcd.(0);
  for j = 1 to n - 1 do
    let m = abcd.(j) in
    let x, y = if i lsr (j - 1) land 1 = 1 then m, '+' else -m, '-' in
    sum := !sum + x;
    add_char b y;
    add_char b @@ char_of_int @@ 48 + m
  done;
  if !sum = 7 then 
    (add_string b "=7";
    to_bytes b |> Bytes.to_string |> print_endline; exit 0)
done