<?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);
    return $X + $Y;
}

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


Measured memory_bytes: 3576