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 PHP (5.6.30) (judge verdict: Wrong Answer)

<?php
$ABCD = fgets(STDIN);
$A = (int) substr($ABCD, 0, 1);
$B = (int) substr($ABCD, 1, 1);
$C = (int) substr($ABCD, 2, 1);
$D = (int) substr($ABCD, 3, 1);
$sum = 7;

// 0の時プラス、1の時マイナス
// 例：$ab=0,$bc=1,$cd=0の時、$A+$B-$C+$D
// 値が負にならないか確認する
for ($ab = 0; $ab < 2; $ab ++) {
    for ($bc = 0; $bc < 2; $bc ++) {
        for ($cd = 0; $cd < 2; $cd ++) {
            if ($ab === 0 && $bc === 0 && $cd === 0) {
                if ($sum === bitPlus(bitPlus(bitPlus($A, $B), $C), $D)) {
                    echo $A . "+", $B . "+" . $C . "+" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 0 && $bc === 0 && $cd === 1) {
                if ($D > bitPlus(bitPlus($A, $B), $C)) {
                    continue;
                } elseif ($sum === bitMinus(bitPlus(bitPlus($A, $B), $C), $D)) {
                    echo $A . "+", $B . "+" . $C . "-" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 0 && $bc === 1 && $cd === 0) {
                if ($C > bitPlus(bitPlus($A, $B), $D)) {
                    continue;
                } elseif ($sum === bitMinus(bitPlus(bitPlus($A, $B), $D), $C)) {
                    echo $A . "+", $B . "-" . $C . "+" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 0 && $bc === 1 && $cd === 1) {
                if (bitPlus($C, $D) > bitPlus($A, $B)) {
                    continue;
                } elseif ($sum === bitMinus(bitMinus(bitPlus($A, $B), $C), $D)) {
                    echo $A . "+", $B . "-" . $C . "-" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 1 && $bc === 0 && $cd === 0) {
                if ($B > bitPlus(bitPlus($A, $C), $D)) {
                    continue;
                } elseif ($sum === bitMinus(bitPlus(bitPlus($A, $C), $D), $B)) {
                    echo $A . "-", $B . "+" . $C . "+" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 1 && $bc === 0 && $cd === 1) {
                if (bitPlus($B, $D) > bitPlus($A, $C)) {
                    continue;
                } elseif ($sum === bitMinus(bitMinus(bitPlus($A, $C), $B), $D)) {
                    echo $A . "-", $B . "+" . $C . "-" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 1 && $bc === 1 && $cd === 0) {
                if (bitPlus($B, $C) > bitPlus($A, $D)) {
                    continue;
                } elseif ($sum === bitMinus(bitMinus(bitPlus($A, $D), $B), $C)) {
                    echo $A . "-", $B . "-" . $C . "+" . $D . "=7";
                    exit(0);
                }
                continue;
            }
            if ($ab === 1 && $bc === 1 && $cd === 1) {
                if (bitPlus(bitPlus($B, $C), $D) > $A) {
                    continue;
                } elseif ($sum === bitMinus(bitMinus(bitMinus($A, $B), $C), $D)) {
                    echo $A . "-", $B . "-" . $C . "-" . $D . "=7";
                    exit(0);
                }
                continue;
            }
        }
    }
}

// 足し算 ：(論理積(&)を左シフト(<<))論理和(|)(排他的論理和(^))
function bitPlus($X, $Y)
{
    return (($X & $Y) << 1) | ($X ^ $Y);
}

// 引き算(絶対値)：排他的論理和(^)
function bitMinus($X, $Y)
{
    return $X ^ $Y;
    //return abs($X - $Y);
}