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 (Python):
s = input()

f = 0

for bit in range(1 << 3):
    ans = s[0]
    f = int(s[0])
    for i in range(3):
        if bit&(1 << i):
            f += int(s[i+1])
            ans += "+"
        else:
            f -= int(s[i+1])
            ans += "-"
        ans += s[i+1]
        
    if f == 7:
        ans += "=7"
        print(ans)
        break

Solution (Python):
def resolve():
    
    n = str(input())
    
    
    
    
    
    
    
    

    N = [int(n[i]) for i in range(len(n))]
    Dic = {1:"+", -1:"-"}

    flag = False
    for i in [-1, 1]:
        for j in [-1, 1]:
            for k in [-1, 1]:
                if N[0] + (i * N[1]) + (j * N[2]) + (k * N[3]) == 7:
                    print(str(N[0]) + Dic[i] + str(N[1]) + Dic[j] + str(N[2]) + Dic[k] + str(N[3]) + "=7")
                    flag = True
                    break
            if flag == True:
                break
        if flag == True:
            break

resolve()

Solution (Python):
N = int(input())
A = N//1000
B = (N%1000)//100
C = (N%100)//10
D = N%10
opdict = {-1:'-', 1:'+'}
for op1 in (-1, 1):
  for op2 in (-1, 1):
    for op3 in (-1, 1):
      if op1*B + op2*C + op3*D == 7 - A:
        print(str(A)+opdict[op1]+str(B)+opdict[op2]+str(C)+opdict[op3]+str(D)+'=7')
        exit()

Solution (Python):
x = str(input())
l = [x[0], x[1], x[2], x[3]]
m = [int(s) for s in l]
N = 2 ** 3
for i in range(N):
  n = [m[0], 0, 0, 0]
  o = [] 
  for j in range(3):
    if (i >> j) & 1:
      n[-j-1] = -m[-j-1]
      o.append('-')
    else:
      n[-j-1] = m[-j-1]
      o.append('+')
  if sum(n) == 7:
    print(str(m[0]) + o[2] + str(m[1]) + o[1] + str(m[2]) + o[0] + str(m[3]) + '=7')
    exit()

Solution (Python):
s=input()
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])
if a+b+c+d==7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d==7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a+b-c+d==7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b-c-d==7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b+c+d==7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c-d==7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d==7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a-b-c-d==7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")

Solution (Python):
abcd=input()

for i in range(8):
    op=['-']*3
    for j in range(3):
        if (i>>j)&1:
            op[j]='+'
    if eval(abcd[0]+op[0]+abcd[1]+op[1]+abcd[2]+op[2]+abcd[3])==7:
        print(abcd[0]+op[0]+abcd[1]+op[1]+abcd[2]+op[2]+abcd[3]+'=7')
        break

Solution (Python):
a=input()
List=list(a)
n=len(List)

for i in range(2**(n-1)):
    s=['-']*(n-1)
    for j in range(n-1):
        if i>>j & 1:
            s[j]='+'

    formula=''

    for num,sign in zip(List,s):
        formula += (num + sign)
    formula += List[n-1]

    if eval(formula)==7:
        print(formula+'=7')
        break

Solution (Python):


import copy

abcd = list(map(int, list(input())))

for i in range(2 ** (len(abcd)-1)):
    abcd_c = copy.deepcopy(abcd)
    for j in range(len(abcd)-1):
        if (i >> j) & 1:
            abcd_c[j+1]*=-1
    if sum(abcd_c) == 7:
        break

for i, v in enumerate(abcd_c):
    if i > 0 and v >= 0:
        print('+', end='')
    print(v, end='')
print('=7')

Solution (Python):



S = input()
ABCD = [int(S[0])]
ABCD.append(int(S[1]))
ABCD.append(int(S[2]))
ABCD.append(int(S[3]))

item = ["+","-"]

for i in range(2**3):

    ans = ABCD[0]
    op = []

    for j in range(0,3):
        if ((i >> j) & 1):
            ans += ABCD[j+1]
            op.append("+")
        else:
            ans -= ABCD[j+1]
            op.append("-")

    if ans == 7:
        print(str(ABCD[0])+op[0]+str(ABCD[1])+op[1]+str(ABCD[2])+op[2]+str(ABCD[3])+"=7")
        break

Solution (Python):
s = list(input())
op = ['+', '-']
for op1 in op:
    for op2 in op:
        for op3 in op:
            ans = s[0]+op1+s[1]+op2+s[2]+op3+s[3]
            if eval(ans) ==7:
                print(ans + '=7')
                exit()

Solution (Python):

s = list(map(str, input()))
n = len(s)

for i in range(2**3):  
    ops = []
    for j in range(3):
        if ((i >> j) & 1):
            ops.append('+')
        else:
            ops.append('-')
    if eval(s[0]+ops[0]+s[1]+ops[1]+s[2]+ops[2]+s[3]) == 7:
        print(s[0]+ops[0]+s[1]+ops[1]+s[2]+ops[2]+s[3] + '=7')
        exit()

Solution (Python):
S = input()
for bit in range(8):
    f = S[0]
    ans = int(S[0])
    for i in range(3):
        if bit&(1<<i):
            f += "+"
            ans += int(S[i + 1])
        else:
            f += "-"
            ans -= int(S[i + 1])
        f += S[i + 1]
    if ans == 7:
        print(f + "=7")
        break

Solution (Python):
n = input()
for i in range(2 ** 3):
    result = int(n[0])
    formura = n[0]
    for j in range(3):  
        if ((i >> j) & 1): 
            result -= int(n[j+1])
            formura += "-"+n[j+1]
        else:
            result += int(n[j+1])
            formura += "+"+n[j+1]
    
    if result == 7:
        print(formura+"=7")
        break

Solution (Python):
a = list(input())

for i in range(8):
    cou = int(a[0])
    ans = a[0]
    for j in range(3):
        if i >> j & 1 == 1:
            cou += int(a[j+1])
            ans += "+" + a[j+1]
        elif i >> j & 1 != 1:
            cou -= int(a[j+1])
            ans += "-" + a[j+1]
    if cou == 7:
        print(ans + "=7")
        exit()

Solution (Python):
s_list = str(input())
A, B, C, D = [int(s) for s in s_list ]
for x in range(2):
    if x==0:
        X = A + B
        px = '+'
    else:
        X = A - B
        px = '-'
    for y in range(2):
        if y==0:
            Y = X + C
            py = '+'
        else:
            Y = X - C
            py = '-'
        for z in range(2):
            if z==0:
                Z = Y + D
                pz = '+'
            else:
                Z = Y - D
                pz = '-'
                
            if Z==7:
                print(A, px, B, py, C, pz, D, '=7', sep='')
                exit()

Solution (Python):
s = input()


def dfs(i, f):
    if i == 3:
        if eval(f) == 7:
            print(f+'=7')
            exit()
    else:
        dfs(i+1, f+'+' + s[i+1])
        dfs(i+1, f+'-' + s[i+1])


dfs(0, s[0])

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





A,B,C,D = map(int,list(S()))

op = [1,-1]
dic = {1:"+",-1:"-"}

for i in range(2):
  for j in range(2):
    for k in range(2):
      if A+B*op[i]+C*op[j]+D*op[k] == 7:
        PE(str(A)+dic[op[i]]+str(B)+dic[op[j]]+str(C)+dic[op[k]]+str(D)+"=7")

Solution (Python):
def dfs(i, f, result):
    if i == l - 1:
        if result == 7:
            print(f + '=7')
            exit()
    else:
        dfs(i + 1, f + '-' + s[i + 1], result - int(s[i + 1]))
        dfs(i + 1, f + '+' + s[i + 1], result + int(s[i + 1]))


s = input()
l = len(s)

dfs(0, s[0], int(s[0]))

Solution (Python):
a = list(map(int,input()))

sep = []
for i in range(2**3):
    sep.append([])
    tmp = a[0]
    for j in range(3):
        if i>>j&1:
            sep[i].append("+")
            tmp += a[j+1]
        else:
            sep[i].append("-")
            tmp -= a[j+1]
    if tmp == 7:
        ans = i
b = []
for i in range(3):
    b.append(str(a[i]))
    b.append(str(sep[ans][i]))
b.append(str(a[3]))
b.append("=7")        
print("".join(b))

Solution (Python):
from itertools import product

A, B, C, D = input()
for op1, op2, op3 in product("+-", repeat=3):
    expr = "{}{}{}{}{}{}{}".format(A, op1, B, op2, C, op3, D)
    if eval(expr) == 7:
        print("{}{}{}{}{}{}{}=7".format(A, op1, B, op2, C, op3, D))
        break

Solution (Python):



import sys


def input():
    return sys.stdin.readline()


def resolve():
    s_4digits = input().rstrip()



    for bit in range(1 << len(s_4digits)-1):
        
        ans = int(s_4digits[0])
        op_list = []
        plus_list = []
        for i in range(len(s_4digits)-1):

            if bit & (1<<i):
                plus_list.append(i)

        
        for j in range(len(s_4digits)-1):
            op_list.append("-")

        for num in plus_list:
            op_list[num] = "+"
        for i, op in enumerate(op_list):
            if op == "+":
                ans += int(s_4digits[i+1])
            else:
                ans -= int(s_4digits[i+1])

        if ans == 7:
            ans_str = s_4digits[0]
            for i, op in enumerate(op_list):
                ans_str += op + s_4digits[i+1]
            print(ans_str + "=7")
            exit()




if __name__ == "__main__":
    resolve()

Solution (Python):
k = input()
for bit in range(1 << 3):
    tmp = int(k[0])
    s = k[0]
    for i in range(3):
        if bit & (1 << i):
            tmp += int(k[i+1])
            s += '+' + k[i+1]
        else:
            tmp -= int(k[i+1])
            s += '-'+k[i+1]
    if tmp == 7:
        print(s + '=7')
        exit(0)

Solution (Python):

import itertools

nn = input()
for ss in itertools.product(["+", "-"], repeat=3):
    tmp = "".join([s1 + s2 for (s1, s2) in zip(nn, ss)]) + nn[-1]
    if eval(tmp) == 7:
        print(tmp + "=7")
        exit()

Solution (Python):


s = input()

for i in range(1<<3):
    sum = int(s[0])
    ans = s[0]
    for k in range(3):
        
        if i>>k&1:
            sum += int(s[k+1])
            ans += '+' + s[k+1]
        else:
            sum -= int(s[k+1])
            ans += '-' + s[k+1]
    if sum == 7:
        print(ans + '=7')
        break

Solution (Python):
abcd = list(input())
op = ['+', '-']

for op1 in op:
    for op2 in op:
        for op3 in op:
            formula = abcd[0] + op1 + abcd[1] + op2 + abcd[2] + op3 + abcd[3]
            if eval(formula) == 7:
                print(formula + '=7')
                exit()

Solution (Python):
A = input()

op = ['+', '-']

for i in range(len(op)):
    for j in range(len(op)):
        for k in range(len(op)):
            if eval(A[0]+op[i]+A[1]+op[j]+A[2]+op[k]+A[3]) == 7:
                print(A[0]+op[i]+A[1]+op[j]+A[2]+op[k]+A[3]+'=7')
                exit()

Solution (Python):
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    abcd = list(map(int, list(readstr())))
    l = [['+', '+', '+'], ['+', '+', '-'], ['+', '-', '+'], ['+', '-', '-'], ['-', '+', '+'], ['-', '+', '-'], ['-', '-', '+'], ['-', '-', '-']]
    for ll in l:
        ans = abcd[0]
        for i, x in enumerate(ll):
            if x == '+':
                ans += abcd[i + 1]
            else:
                ans -= abcd[i + 1]
        if ans == 7:
            s = ''
            for i in range(3):
                s += str(abcd[i]) + ll[i]
            s += str(abcd[3])
            print(s + '=7')
            break


if __name__ == "__main__":
    main()

Solution (Python):
S = input()
def saiki(i,s):
    if i == 3:
        if eval(s) == 7:
            print(str(s) + "=7")
            exit()
        else:
            return
    saiki(i+1,s+"+"+S[i+1])
    saiki(i+1,s+"-"+S[i+1])

saiki(0,S[0])

Solution (Python):
import math
import string
import collections
from collections import Counter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
a, b, c, d = map(int, input())

if a+b+c+d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
    exit()
if a+b-c+d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
    exit()
if a+b+c-d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
    exit()
if a+b-c-d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
    exit()
if a-b+c+d == 7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
    exit()
if a-b-c+d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
    exit()
if a-b+c-d == 7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
    exit()
if a-b-c-d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
    exit()

Solution (Python):
A, B, C, D = input()
A1 = int(A)
B1 = int(B)
C1 = int(C)
D1 = int(D)
if A1+B1+C1+D1 == 7:
  print(A+'+'+B+'+'+C+'+'+D+'=7')
elif A1+B1+C1-D1 == 7:
  print(A+'+'+B+'+'+C+'-'+D+'=7')
elif A1+B1-C1+D1 == 7:
  print(A+'+'+B+'-'+C+'+'+D+'=7')
elif A1+B1-C1-D1 == 7:
  print(A+'+'+B+'-'+C+'-'+D+'=7')
elif A1-B1+C1+D1 == 7:
  print(A+'-'+B+'+'+C+'+'+D+'=7')
elif A1-B1+C1-D1 == 7:
  print(A+'-'+B+'+'+C+'-'+D+'=7')
elif A1-B1-C1+D1 == 7:
  print(A+'-'+B+'-'+C+'+'+D+'=7')
elif A1-B1-C1-D1 == 7:
  print(A+'-'+B+'-'+C+'-'+D+'=7')

Solution (Python):
def dfs(i, s, sum):
    if i == 3:
        if sum == 7:
            print(s + "=7")
            exit()
    else:
        dfs(i + 1, s + "+" + abcd[i + 1], sum + int(abcd[i + 1]))
        dfs(i + 1, s + "-" + abcd[i + 1], sum - int(abcd[i + 1]))
abcd = input()
dfs(0, abcd[0], int(abcd[0]))

Solution (Python):
import itertools
n = input()
a, b, c, d = n

for i, j, k in itertools.product(["+", "-"], repeat=3):
    if eval(a + i + b + j + c + k + d) == 7:
        print(a+i+b+j+c+k+d + "=7")
        exit()

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True




def warshall_floyd(d, n):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d



def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)






def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



s = input()
a = ""
for i in range(1 << 3):
    bit = bin(i)[2:].zfill(3)
    total = int(s[0])
    for j in range(3):
        if bit[j] == "1":
            total += int(s[j + 1])
        else:
            total -= int(s[j + 1])
    if total == 7:
        a = bit
        break

ans = ""
for i in range(4):
    if i == 0:
        ans += s[i]
    else:
        if bit[i - 1] == "1":
            ans += "+" + s[i]
        else:
            ans += "-" + s[i]
ans += "=7"
print(ans)

Solution (Python):
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=input()
l=[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]
for i in range(len(l)):
    s=int(n[0])
    if l[i][0]==0:
        s+=int(n[1])
        t1="+"
    else:
        s-=int(n[1])
        t1="-"
    if l[i][1]==0:
        s+=int(n[2])
        t2="+"
    else:
        s-=int(n[2])
        t2="-"
    if l[i][2]==0:
        s+=int(n[3])
        t3="+"
    else:
        s-=int(n[3])
        t3="-"

    if s==7:
        print(n[0]+t1+n[1]+t2+n[2]+t3+n[3]+"=7")
        exit()
print("No")

Solution (Python):
S = input().strip()
a = S[0]
b = S[1]
c = S[2]
d = S[3]

for op1 in ["+", "-"]:
    for op2 in ["+", "-"]:
        for op3 in ["+", "-"]:
            cal = a + op1 + b + op2 + c + op3 + d
            left = int(eval(cal))
            if left == 7:
                print(cal + "=7")
                exit()

Solution (Python):
from itertools import product
A,B,C,D =list(input())
for z in product(("+","-"),repeat=3):
    if eval(A+z[0]+B+z[1]+C+z[2]+D)==7:
        print(A+z[0]+B+z[1]+C+z[2]+D+"=7")
        break

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

ABCD = list(input())

for i in range(2 ** 3):
    tmp = int(ABCD[0])
    for j in range(3):
        if (i >> j) & 1:
            tmp += int(ABCD[j + 1])
        else:
            tmp -= int(ABCD[j + 1])
    if tmp == 7:
        print (ABCD[0], end = '')
        print ('+' if (i >> 0) & 1 else '-', end = '')
        print (ABCD[1], end = '')
        print ('+' if (i >> 1) & 1 else '-', end = '')
        print (ABCD[2], end = '')
        print ('+' if (i >> 2) & 1 else '-', end = '')
        print (ABCD[3], end = '=7\n')
        exit()

Solution (Python):
a = list(map(int, list(input())))
f = lambda x: '+' if x==1 else '-'
for i in range(-1, 2, 2):
    for j in range(-1, 2, 2):
        for k in range(-1, 2, 2):
            if a[0]+i*a[1]+j*a[2]+k*a[3]==7:
                print(str(a[0])+f(i)+str(a[1])+f(j)+str(a[2])+f(k)+str(a[3])+'=7')
                exit()

Solution (Python):
import sys
s = str(input())

A = []
for i in range(len(s)):
  A.append(s[i])
  
for i in range(2**3):
  p = []
  for j in range(3):
    if (i>>j)&1 == 1:
      p.append("+")
    else:
      p.append("-")
  temp = s[0]
  for t in range(3):
    temp += p[t]
    temp += s[t+1]
  
  if eval(temp) == 7:
    ans = temp+"=7"
    print(ans)
    sys.exit()

Solution (Python):
def resolve():
  s = input()
  for i in range(1<<3):
    e = s[0]
    e += '+' if ((i>>0) & 1) else '-'
    e += s[1]
    e += '+' if ((i>>1) & 1) else '-'
    e += s[2]
    e += '+' if ((i>>2) & 1) else '-'
    e += s[3]
    if eval(e) == 7:
      e += '=7'
      print(e)
      return
  return

if __name__ == "__main__":
  resolve()

Solution (Python):
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    ABCD = list(input())

    for pattern in product(["+", "-"], repeat=3):
        pattern = list(pattern) + [" "]
        fomula = []
        for op, num in zip(pattern, ABCD):
            fomula.append(num)
            fomula.append(op)
        fomula = "".join(fomula).rstrip()
        if eval(fomula) == 7:
            print(fomula + "=" + "7")
            break
        else:
            continue
        break


if __name__ == '__main__':
    resolve()

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a = list(input())
a = [int(i) for i in a]
for fl in itertools.product(range(2),repeat=3):
    now = a[0]
    for i,x in enumerate(fl):
        if x:
            now += a[i+1]
        else:
            now -= a[i+1]
    if now == 7:
        L = str(a[0])
        for i,x in enumerate(fl):
            tmp = '+' if x else '-'
            L += tmp + str(a[i+1])
        print(L+'=7')
        quit()

Solution (Python):
import itertools
a = list(input())

for v in itertools.product(["+", "-"], repeat=3):
  x = a[0] + v[0] + a[1] + v[1] + a[2] + v[2] + a[3]
  if eval(x) == 7: break
print(x+"=7")

Solution (Python):
from itertools import product

s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
L = [a, b, c, d]
kumiawase = list(product([1, 0], repeat=3))

for kumi in kumiawase:
    res = a
    for i in range(3):
        if kumi[i] == 0:
            res += L[i + 1]
        else:
            res -= L[i + 1]
    if res == 7:
        break
ans = s[0]
for i in range(3):
    if kumi[i] == 0:
        ans += "+"
    else:
        ans += "-"
    ans += s[i + 1]
ans += "=7"
print(ans)

Solution (Python):
from itertools import combinations_with_replacement, permutations


def main():
    abcd = list(input())
    can_break = False
    for pp in combinations_with_replacement(["+", "-"], 3):
        if can_break:
            break
        for p in permutations(pp):
            now = [abcd[0]]
            for i in range(3):
                now.append(p[i])
                now.append(abcd[i + 1])
            now_f = "".join(now)
            if eval(now_f) == 7:
                print(now_f + "=7")
                can_break = True
                break


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
for i in range(2**3):
    l = []
    for j in range(3):
        if (i>>j)&1:
            l.append("+")
        else:
            l.append("-")
    if eval("{}{}{}{}{}{}{}".format(s[0],l[0],s[1],l[1],s[2],l[2],s[3])) == 7:
        print("{}{}{}{}{}{}{}=7".format(s[0],l[0],s[1],l[1],s[2],l[2],s[3]))
        break

Solution (Python):
A = list(input())

A,B,C,D = A[0],A[1],A[2],A[3]

for op1 in ['+','-']:
    for op2 in ['+','-']:
        for op3 in ['+','-']:
            if eval(A+op1+B+op2+C+op3+D) == 7:
                print(A+op1+B+op2+C+op3+D+'=7')
                exit()

Solution (Python):
s=input()
A=int((list(s))[0])
B=int((list(s))[1])
C=int((list(s))[2])
D=int((list(s))[3])

for i in range(2**3):
    a=[]
    b=A
    for k in range(3):
        if (i>>k)&1==1:
            a.append("+")
            b+=int(list(s)[k+1])
        else:
            a.append("-")
            b-=int(list(s)[k+1])
    if b==7:
        print(A,a[0],B,a[1],C,a[2],D,"=7",sep="")
        break

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C,D = list(map(int,list(_in[0])))  
    
    arr = [B,C,D]
    N = len(arr)
    for bit in range(1<<N):
        
        sum_ = A
        for i,x in enumerate(arr):
            if bit&(1<<i):
                sum_ += x
            else:
                sum_ -= x
        if sum_ == 7:
            str_ = str(A)
            for i,x in enumerate(arr):
                if bit&(1<<i):
                    str_ += '+'+str(x)
                else:
                    str_ += '-'+str(x)
            str_ += '=7'
            break
    
    print(str_)

Solution (Python):
S = input()

def saiki(i,s = S[0]):
    if i == 3:
        if eval(s) == 7:
            print(str(s) + "=7")
            exit()
        else:
            return            
    saiki(i + 1, s + "+" + S[i+1])
    saiki(i + 1, s + "-" + S[i+1])

saiki(0)

Solution (Python):



def main():
    S = input()
    l = len(S)-1
    for i in range(2**l):
        fs = S[0]
        for j in range(l):
            if (i>>j & 1) == 1:
                fs += '+'
            else:
                fs += '-'
            fs += S[j+1]
        if eval(fs)==7:
            ret = fs + '=7'
            break
    print(ret)

if __name__ == '__main__':
    main()

Solution (Python):
ABCD=str(input())
A=int(ABCD[0])
B=int(ABCD[1])
C=int(ABCD[2])
D=int(ABCD[3])
listA=[A,B,C,D]
for i in range(2**3):
    listn=[0]*3
    for j in range(3):
        if ((i>>j)&1):
            listn[j]=1
    num=A
    for k in range(3):
        if listn[k]==0:
            num+=listA[k+1]
            listn[k]="+"
        elif listn[k]==1:
            num-=listA[k+1]
            listn[k]="-"
    if num==7:
        print(str(A)+listn[0]+str(B)+listn[1]+str(C)+listn[2]+str(D)+"=7")
        break

Solution (Python):
S = input()
a = len(str(S))-1
 
for i in range(2**a):  
    temp = str(S)[0]  
    for j in range(a):
        if i & (1<<j):
            temp += "+"
        else:
            temp += "-"
        temp+=str(S)[j+1]
    
    if eval(temp) == 7:
        print("{}=7".format(temp))
        break

Solution (Python):
import sys
abcdf=list(input()) 
abcd=[int(i) for i in abcdf]


for i in range(2 ** 3):
  nsum=abcd[0]
  op=[]
  for j in range(3):  
    if ((i >> j) & 1):
      nsum+=abcd[j+1]
      op.append('+')
    else:
      nsum-=abcd[j+1]
      op.append('-')
  if nsum==7:
    print(abcdf[0]+op[0]+abcdf[1]+op[1]+abcdf[2]+op[2]+abcdf[3]+'=7')
    sys.exit(0)

Solution (Python):
S=input()
for bit in range(1<<3):
    f=int(S[0])
    s=S[0]
    for i in range(3):
        if bit&(1<<i):
            f+=int(S[i+1])
            s+="+"+S[i+1]
        else :
            f-=int(S[i+1])
            s+="-"+S[i+1]
    if f==7:
        print(s+"=7")
        exit()

Solution (Python):
s = input()

for i in range(8):
    siki = s[0]
    for j in range(3):
        bitchk = 2 ** j
        if i & bitchk:
            siki += '+'
        else:
            siki += '-'
        siki += s[j+1]
    ans = eval(siki)
    if ans == 7:
        print(siki, '=7', sep='')
        exit()