Problem:
Score : 300 points

Problem Statement

Sitting in a station waiting room, Joisino is gazing at her train ticket.

The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).

In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.

The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Constraints

0≤A,B,C,D≤9

All input values are integers.

It is guaranteed that there is a solution.

Input

Input is given from Standard Input in the following format:

ABCD

Output

Print the formula you made, including the part =7.

Use the signs + and -.

Do not print a space between a digit and a sign.

Sample Input 1

1222

Sample Output 1

1+2+2+2=7

This is the only valid solution.

Sample Input 2

0290

Sample Output 2

0-2+9+0=7

0 - 2 + 9 - 0 = 7 is also a valid solution.

Sample Input 3

3242

Sample Output 3

3+2+4-2=7

Solution in OCaml (4.02.3) (judge verdict: Accepted)

type op =
  | Plus
  | Minus
  | Id

let print_op = function
    Plus -> print_char '+'
  | Minus -> print_char '-'
  | Id -> ()

(* list_all 2 [true; false];;
 * - : bool list list =
 * [[true; true]; [false; true]; [true; false]; [false; false]] *)
(* olに含まれる要素で作れる長さnのリストすべてを返す *)
let rec list_all : int -> 'a list -> 'a list list  = fun n ol ->
  if n > 0 then
    List.fold_right (fun l ans ->
        List.fold_right
          (fun o xs ->
             (o :: l) :: xs)
          ol ans)
      (list_all (n - 1) ol) []
  else
    [[]]

let calc_op l opss =  
  let rec loop ans =
    (function
      | (x :: xs, o :: os) ->
      (match o with
          Plus -> loop (ans + x) (xs, os)
        | Minus -> loop (ans - x) (xs, os)
        | Id -> loop x (xs, os))
      | _ -> ans)
  in
  loop 0 (l, opss)  

let ic c = int_of_char c - int_of_char '0'

let () =
  let (a, b, c, d) = Scanf.sscanf (input_line stdin) "%c%c%c%c" (fun a b c d -> (ic a, ic b, ic c, ic d)) in
  let ops_lists = list_all 3 [Plus; Minus] in
  let ops_lists' = List.map (fun ops -> Id :: ops) ops_lists in
  let rec solve = function
      [] -> failwith "Not found"
    | ops :: opss ->
      if calc_op [a;b;c;d] ops = 7 then
        ops
      else
        solve opss
  in
  let ans = solve ops_lists' in
  List.iter2 (fun x op ->
      print_op op;
      print_int x) [a;b;c;d] ans;
  print_string "=7";
  print_newline ()