Harryxun/stf_run huggingface dataset:
S = int(input())

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(idx//2)
  else:
    A.append(idx*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1
      

### FIXED CODE ###

S = int(input())

A = [S]
idx = 0
while True:
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+2)
    break
  idx += 1
aI, aO, aT, aJ, aL, aS, aZ = map(int, input().split())

if aL%2 and aJ%2:
    print(int((aI-1)/2)*2+aO+int(aJ/2)*2+int(aL/2)*2+3)
else:
    print(int(aI/2)*2+aO+int(aJ/2)*2+int(aL/2)*2)


### FIXED CODE ###

x, y = map(int, input().split())

a = abs(abs(x)-abs(y))

if (x < 0 and y <= 0 and abs(x) > abs(y)) or (x >= 0 and y >= 0 and abs(x)<abs(y)):
    b = 0
elif (x < 0 and y > 0) or (x >= 0 and y <= 0):
    b = 1
else:
    b = 2

print(a+b)
import itertools

H,N = map(int,input().split())
A = list(map(int,input().split()))
l = list(itertools.permutations(A,N))

ans = []
for i in l:
    if sum(i) >= H:
        ans.append("Yes")
    else:
        ans.append("No")

if "Yes" in ans:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

H,A = map(int,input().split())

if H % A >= 1:
    ans = (H//A) +1
    print(ans)
else:
    ans = (H//A)
    print(ans)
n = input()
vals = list(map(int, input().split()))
s = sum(vals)
ret = 0
for i, val in enumerate(vals):
    ret += val * (s - val)

mod = 10 ** 9 + 7
print(int(ret/2) % mod))

### FIXED CODE ###

n = input()
vals = list(map(int, input().split()))
s = sum(vals)
ret = 0
for i, val in enumerate(vals):
    ret += val * (s - val)

mod = 10 ** 9 + 7
print(int(ret//2) % mod)
import math
def fib(number):
    a, b = 0, 1
    if number == 1:
        return a
    elif number == 0:
        return b
    else:
        for _ in range(number-2):
            a, b = b, a + b
        return b
N, M = map(int, input().split())
a = []
ans = 1
tmp = 0
for _ in range(M):
    a.append(int(input()))
for i in a:
    number = i-1-tmp
    if number<1:
        print(0)
        exit()
    else:
        ans *= fib(number)
        tmp = i
print(number)

### FIXED CODE ###

import math
def fib(number):
    a, b = 0, 1
    for _ in range(number):
        a, b = b, a + b
    return b
N, M = map(int, input().split())
a = []
ans = 1
tmp = 0
for _ in range(M):
    a.append(int(input()))
for i in a:
    number = i-tmp
    if i == 1:
        tmp = 2
        continue
    else:
        if number<1:
            print(0)
            exit()
        else:
            ans *= fib(number-1)
            tmp = i+1
print((ans*fib(N-tmp))%1000000007)
a = int(input())
b = int(input())

c = a*b

if(c%2==0)
   print("Even")
  else
   print("Odd")

### FIXED CODE ###

a,b = map(int, input().split())

if ((a*b)%2==0):
    print('Even')
else:
    print('Odd')
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()

res = 0
for b in B:
    insert_index_A = bisect.bisect_left(A, b)
    insert_index_C = bisect.bisect_right(C, b)
    res += insert_index_A * (N - insert_index_C)
    
print(res)

### FIXED CODE ###

import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
res = 0
for i in B:
    res += bisect.bisect_left(A, i) * (N - bisect.bisect_right(C, i))
    
print(res)
from fractions import gcd

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

N, M = map(int, input().split())
S = input()
T = input()

L = lcm(N, M)
X = [S[0]] * L
step_N = L // N
step_M = L // M

if S[0] != T[0]:
    ans = -1
elif step_N == 1 or step_M == 1:
    ans = -1
else:
    for i in range(1, N):
        X[i * step_N] = S[i]

    for i in range(1, M):
        X[i * step_M] = T[i]

    check_N = ''.join(X[::step_N])
    check_M = ''.join(X[::step_M])

    if check_N == S and check_M == T:
        ans = L
    else:
        ans = -1

print(ans)

### FIXED CODE ###

from fractions import gcd

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

N, M = map(int, input().split())
S = input()
T = input()

n = N // gcd(N, M)
m = M // gcd(N, M)
k = gcd(N, M)

for i in range(k):
    if S[i * n] != T[i * m]:
        print(-1)
        exit()

print(lcm(N, M))
C *= 2
ans = 0

if A >= C and B >= C:
    ans += max(X, Y) * C
elif C >= A+B:
    ans += A*X + B*Y
elif C >= max(A,B):
    if X>Y:
        ans += Y*C + (X-Y)*A
    else:
        ans += X*C + (Y-X)*B
else:
    if A >= C:
        ans += X*C
        if Y-X>0:
            ans+=Y*B
    else:
        ans += Y*C
        if X-Y:
            ans+=X*A

print(ans)

### FIXED CODE ###

A, B, C, X, Y = list(map(int, input().split()))
C *= 2
ans = 0

if A >= C and B >= C:
    ans += max(X, Y) * C
elif C >= A+B:
    ans += A*X + B*Y
elif C >= max(A,B):
    if X>Y:
        ans += Y*C + (X-Y)*A
    else:
        ans += X*C + (Y-X)*B
else:
    if A >= C:
        ans += X*C
        if Y-X>0:
            ans+=(Y-X)*B
    else:
        ans += Y*C
        if X-Y>0:
            ans+=(X-Y)*A

print(ans)
S = input()

S = [s for s in S]

ans = 0
while len(S) > 0:
    counter = 0
    for ix in range(len(S)):
        if ix+1 < len(S):
            if S[ix] != S[ix+1]:
                print(S)
                del S[ix]
                del S[ix]
                ans += 1
                counter += 1
                break
    if counter == 0:
        break

print(ans*2)

### FIXED CODE ###


S = input()

S = [s for s in S]
S = [int(s, 0) for s in S]
S.sort()
if 1 in S and  0 in S:
    print(min(S.count(0)*2,S.count(1)*2))
else:
    print(0)
def main():
    N, M = map(int, input().split(" "))
    A = [-1]
    maximum = 0
    way = [1, 2]
    mod = 1000000007
    result = 1
    for i in range(M):
        a = int(input())
        if A[-1] + 1 == a:
            return 0
        else:
            maximum = max(maximum, a - A[-1])
            A.append(a)
    for i in range(2, maximum):
        way.append(way[i - 2] + way[i - 1])
    for j in range(1, M):
        result = result * (way[j] - way[j - 1] + 1) % mod
    return result


if __name__ == '__main__':
    print(main())

### FIXED CODE ###

def main():
    mod = 1000000007
    N, M, *A = map(int, open(0).read().split())
    A = set(A)
    F = [0] * (N + 1)
    F[0] = 1
    if 1 not in A:
        F[1] = 1
    for i in range(2, N + 1):
        if i not in A:
            F[i] = (F[i-1] + F[i-2]) % mod
    print(F[N])


if __name__ == "__main__":
    main()
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')

    

### FIXED CODE ###

# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')
N, M = map( int, input().split())
A = list( map( int, input().split()))
C = [0,2,5,5,4,5,6,3,7,6]
H = [0]*10
dp = [(0,0)]*(N+1)
for a in A:
    if H[C[a]] < a:
        H[C[a]] = a
H = [ str(h) for h in H]
for a in A:
    dp[C[a]] = (1,0)
Z = sorted(list( set( [ C[a] for a in A])))
for i in range(2,N+1):
    for z in Z:
        if i >= z:
            if dp[i-z][0] == 1:
                dp[i] = (1, i-z)
                break
b = 1
s = N
ANS = [0]*10
while b != 0:
    a, b = dp[s]
    ANS[s-b] += 1
    s = b
ans = ""
for i in range(9,0,-1):
    if ANS[C[i]] > 0:
        if i in A:
            ans += str(i)*ANS[C[i]]
            ANS[C[i]] = 0
print( ans)

### FIXED CODE ###

N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*10
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    if x <= N:
        dp[x] = 1
for i in range(1,N):
    t = dp[i]
    for x in Check:
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for a in A:
        x = Needs[a]
        if t-x>=0:
            if dp[t-x]+1 == dp[t]:
                W[V[x]] += 1
                t -= x
                break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)
s = int(list(input()))
print(sum(s))

### FIXED CODE ###

s = list(input())
print(int(s[0])+int(s[1])+int(s[2]))
S = input()

if S[1]==S[0]:
	count1=count1+1
	if S[2]==S[0] or S[3]==S[0]:
		print('No')
	elif S[3]==S[2]:
		print('Yes')
elif (S[2]==S[0] and S[3]==S[1]) or (S[2]==S[1] and S[3]==S[0]):
	print('Yes')
else:
	print('No')


### FIXED CODE ###

S = input()

if (S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]) or (S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]) or (S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]):
	print('Yes')
else:
	print('No')
num = int(input())
sum = 0

for i in range(num):
  a,b = input().split(" ")
  if b == "JPY":
    a = int(a)
    sum += a
  
  else:
    a = int(a)
    c = a * 380000
    sum += c
   
print(sum)

### FIXED CODE ###

num = int(input())
sum = 0

while num > 0:
  a,b = input().split(" ")
  if b == "JPY":
    sum += int(a)
    
  else:
    c = float(a) * 380000
    sum += c
  num -= 1    
print(sum)
import numpy as np

N = int(input())
A = [int(i) for i in input().split()]
a = np.array(A)
sum = np.prod(a)

if  sum > 1000000000000000000:
    print(-1)
else:
    print(sum)


### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a = k()
b = l()
b.sort()
ans = 1
for i in b:
    if i == 0:
        print(0)
        sys.exit()
    else:
        ans *= i
    if ans > 10**18:
        print(-1)
        sys.exit()

print(ans)
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if p[i] - 1 == i:
        count += 1
        p[i] ,p[i + 1] = p[i + 1], p[i]
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-1):
    if p[i] - 1 == i:
        count += 1
        p[i] ,p[i + 1] = p[i + 1], p[i]
if p[n - 1] - 1 == n - 1:
    count += 1
print(count)
n, a, b = map(int, input().split())

n_div_ab = n // (a+b)
n_mod_ab = n % (a+b)
if a == 0:
    res = 0
if n_mod_ab // a > 0:
    res = n_mod_ab // a * a
else:
    res = n_mod_ab
print(n_div_ab * a + res)

### FIXED CODE ###

n, a, b = map(int, input().split())

n_div_ab = n // (a+b)
n_mod_ab = n % (a+b)
if a == 0:
    res = 0
elif n_mod_ab // a > 0:
    res = a
else:
    res = n_mod_ab

print(n_div_ab * a + res)
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline
    INF = 10**9

    H, W, K = map(int, input().split())
    chocolate = [ input()[:-1] for _ in range(H) ]
    
    loop_H = range(H)
    loop_W = range(W)
    white_chocolate = [ [0]*(W+1) for _ in range(group_number+1) ]
    min_cut = INF-1
    for div in range(1 << (H-1)):
        # 横割りでグループ分け
        group = [[]]
        group_number = 0
        for i in loop_H:
            group[group_number].append(i)
            if div >> i & 1:
                group.append([])
                group_number += 1
        # グループごと白チョコを数える
        for i in loop_W:
            for g in range(group_number+1):
                white_chocolate[g][i] = 0
                for j in group[g]:
                    if chocolate[j][i] == '1':
                        white_chocolate[g][i] += 1
        # 縦に切っていく
        cut = group_number
        zeros = [0] * len(white_chocolate)
        now = zeros.copy()
        for w in loop_W:
            for g in range(len(white_chocolate)):
                if white_chocolate[g][w] > K:
                    cut = INF
                    break
                else:
                    now[g] += white_chocolate[g][w]
                if now[g] + white_chocolate[g][w+1] > K:
                    cut += 1
                    now = zeros.copy()
                    break
            if cut == INF:
                break
        if cut < min_cut:
            min_cut = cut
    print(min_cut)

main()

### FIXED CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline
    INF = 10**9

    H, W, K = map(int, input().split())
    chocolate = [ input()[:-1] for _ in range(H) ]
    
    loop_H = range(H)
    loop_W = range(W)
    min_cut = INF-1
    for div in range(1 << (H-1)):
        # 横割りでグループ分け
        group = [[]]
        group_number = 0
        for i in loop_H:
            group[group_number].append(i)
            if div >> i & 1:
                group.append([])
                group_number += 1
        # 縦に切っていく
        cut = group_number
        zeros = [0] * len(group)
        cnt = zeros.copy()
        w = 0
        while w < W:
            now = zeros.copy()
            for g in range(len(group)):
                for i in group[g]:
                    if chocolate[i][w] == '1':
                        now[g] += 1
                if now[g] > K:
                    cut = INF
                    break
                if cnt[g] + now[g] > K:
                    cut += 1
                    w -= 1
                    cnt = zeros.copy()
                    break
                cnt[g] += now[g]
            w += 1
        if cut < min_cut:
            min_cut = cut
    print(min_cut)

main()
max_counter = 0

def check(limit, a, b, i, j, counter):
    global max_counter
    
    if len(a) > i:
        if limit - a[i] >= 0:

            check(limit - a[i], a, b, i + 1, j, counter + 1)

            if counter > max_counter:
                max_counter = counter

    if len(b) > j:
        if limit - b[j] >= 0:

            check(limit - b[j], a, b, i, j + 1, counter + 1)

            if counter > max_counter:
                max_counter = counter

    return

def main():
    global max_counter
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    check(k, a, b, 0, 0, 1)

    print(max_counter)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    a_sum = [0]
    b_sum = [0] 

    max_counter = 0

    j = m

    for i in range(n):
        a_sum.append(a_sum[i] + a[i])

    for i in range(m):
        b_sum.append(b_sum[i] + b[i])

    for i in range(n + 1):
        if a_sum[i] > k:
            break

        while k < a_sum[i] + b_sum[j]:
            j -= 1
        
        max_counter = max(max_counter, i + j)

    print(max_counter)

if __name__ == '__main__':
    main()
import.math

N=int(input())
A=list(map(int,input().split()))
l=[]

for _ in A:
  l.append(math.log10(A))
  
if sum(l)<18:
  print(math.exp(sum(l)))
else:
  print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))

if 0 in a:
  print(0)

else:
  ans = 1
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      print(-1)
      exit()
  print(ans)
a,b,c=[int(i) for i in input().split()]
if(a>b &&a>c):
  print(10*a+b+c)
elif(b>a &&  b>c):
  print(10*b+c+a)
else:
  print(a+b+10+c)

### FIXED CODE ###

a=list(map(int,input().split()))
a.sort()
print(10*a[-1]+a[0]+a[1])
# -*- coding: utf-8 -*-


N, M , Q =  [int(i) for i in input().split()]

numbers = []
for i in range(Q):
    numbers.append([int(j) for j in input().split()])

numbers = sorted(numbers , key = lambda x:-x[1])
#print(numbers)

kouho = ["9"*(N)]
#print(kouho)
for a, b , c ,d in numbers:
    for k in kouho:
        if int(k[b-1]) - int(k[a-1]) != c:
            new_k = k[:a-1] + str(int(k[b-1])-c) +  k[a:]
            if str(int(k[b-1])-c) >= 0:
                kouho.append(new_k)
                kouho = list(set(kouho))

#print(sorted(kouho))

answers = [0] * len(kouho)
for i, k in  enumerate(kouho):
    ans = 0
    for a, b, c, d in numbers:
        if int(k[b-1]) - int(k[a-1]) == c:
            ans += d
    answers[i] = ans
print(max(answers))
'''
kouho = []
for password in range(0,10**(N-1)):
    password = "9" + str(password).zfill(N-1)
    kouho.append(''.join(list(reversed(password))))

answers = [0] * len(kouho)
for i, k in  enumerate(kouho):
    ans = 0
    for a, b, c, d in numbers:
        if int(k[b-1]) - int(k[a-1]) == c:
            ans += d
    answers[i] = ans
print(max(answers))
'''


### FIXED CODE ###

import itertools

N, M , Q =  [int(i) for i in input().split()]

numbers = []
for i in range(Q):
    numbers.append([int(j) for j in input().split()])


A = list(itertools.combinations_with_replacement(range(1,M+1),N))

answer = 0
for k in  A:
    ans = 0
    for a, b, c, d in numbers:
        if int(k[b-1]) - int(k[a-1]) == c:
            ans += d
    if answer < ans:
        answer = ans
print(answer)
a,b = input().split()

print("H" if (a == "H" ^ b == "H") else "D")


### FIXED CODE ###

a,b = input().split()

print("H" if (a == "D") ^ (b == "H") else "D")
A,B,C,D = map(int,input().split())

inter1 = [i for i in range(A,B + 1)]
inter2 = [i for i in range(C,D + 1)]

inter3 = []

for i in range(0,max(B,D)):
  if i in inter1 and i in inter2:
    inter3.append(i)
    
print(max(inter3) - min(inter3))

### FIXED CODE ###

A,B,C,D = map(int,input().split())
 
alice = [i for i in range(A,B + 1)]
bob = [i for i in range(C,D + 1)]
 
common = [i for i in bob if i in alice]

if len(common) == 0:
  print(0)
else:
  print(len(common)-1)
n , k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = []
for i in range(n):
    visit = [-1 for i in range(n)]
    cou = 0
    visit[i] = 0
    kar = []
    now = i
    while True:
        cou += 1
        if cou > k:
            break
        nex = p[now] - 1
        if visit[nex] == -1:
            visit[nex] = cou
            if kar:
                kar.append(kar[-1] + c[nex])
            else:
                kar.append(c[nex])
            now = nex
        elif visit[nex] != -1:
            if kar:
                lokz = cou
                losu = kar[-1] + c[nex]
                if losu > 0:
                    kar.append(losu * (k//lokz) + max(kar[:(k%lokz)]))
                break
            else:
                if c[nex] >= 0:
                    kar.append(c[nex]*k)
                elif c[nex] < 0:
                    kar.append(c[nex])
                break
    ans.append(max(kar))
print(max(ans))

### FIXED CODE ###

n , k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))
loop = []
visit = [(-1,-1) for i in range(n)]
cou = -1
for i in range(n):
    if visit[i] != (-1,-1):
        continue
    cou += 1
    tyu  = [i]
    now = i
    visit[i] = (cou,0)
    t = 1
    while True:
        nex = p[now] - 1
        if nex == i:
            break
        visit[nex] = (cou,t)
        tyu.append(nex)
        now = nex
        t += 1
    loop.append(tyu)

ans = []

for i in range(n):
    p = loop[visit[i][0]][visit[i][1]:] + loop[visit[i][0]][:visit[i][1]]
    kar = [0]
    kouho = []
    losum = 0
    lokz = len(p)
    for j in p:
        losum += c[j]
        kar.append(kar[-1] + c[j])
    if losum >= 0:
        for l in range(lokz+1):
            if l > k:
                break
            cou = losum*((k-l)//lokz) + kar[l]
            kouho.append(cou)
    elif losum < 0:
        for l in range(1,lokz+1):
            if l > k:
                break
            cou = kar[l]
            kouho.append(cou)
    ans.append(max(kouho))
print(max(ans))
def func(long n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1

s = int(input())

data = set(s)

for i in range(1000010):
    l = len(data)
    val = func(s)
    data.add(val)
    if l == len(data):
        print(i+2)
        break
    s = val


### FIXED CODE ###

def func(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1

s = int(input())
data = set()
data.add(s)
for i in range(1000010):
    l = len(data)
    val = func(s)
    data.add(val)
    if l == len(data):
        print(i+2)
        break
    s = val
def resolve():
  a, b, c = map(int, input().split())
 
    temp_a = a
    temp_b = b
    a = temp_b
    b = temp_a
    temp_c = c
    temp_a = a
    c = temp_a
    a = temp_c
    print(a, b, c)

### FIXED CODE ###

n = list(map(int,input().split()))
print(n[2],n[0],n[1])
N, M = map(int, input().split())
path = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    path[x].append(y)

dp = [0] * N
def dfs(v, dist):
    for i in path[v]:
        dp[v] = max(dp[v], dfs(i, dist+1))
    return dist

for i in range(N):
    dfs(i, 0)
print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N, M = map(int, input().split())
path = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    path[x].append(y)

dp = [-1] * N
def dfs(v):
    if dp[v] > -1:
        return dp[v] + 1
    ret = 0
    for i in path[v]:
        ret = max(ret, dfs(i))
    dp[v] = ret
    return ret + 1


for i in range(N):
    if dp[i] < 0:
        dfs(i)

print(max(dp))
A, B, C, D = map(int, raw_input().split())

if A+B+C+D == 7:
    print '%s+%s+%s+%s' % (A, B, C, D)
elif A+B+C-D == 7:
    print '%s+%s+%s-%s' % (A, B, C, D)
elif A+B-C+D == 7:
    print '%s+%s-%s+%s' % (A, B, C, D)
elif A-B+C+D == 7:
    print '%s-%s+%s+%s' % (A, B, C, D)
elif A+B-C-D == 7:
    print '%s+%s-%s-%s' % (A, B, C, D)
elif A-B+C-D == 7:
    print '%s-%s+%s-%s' % (A, B, C, D)
elif A-B-C+D == 7:
    print '%s-%s-%s+%s' % (A, B, C, D)
elif A-B-C-D == 7:
    print '%s-%s-%s-%s' % (A, B, C, D)

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = raw_input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

if A+B+C+D == 7:
    print '%s+%s+%s+%s=7' % (A, B, C, D)
elif A+B+C-D == 7:
    print '%s+%s+%s-%s=7' % (A, B, C, D)
elif A+B-C+D == 7:
    print '%s+%s-%s+%s=7' % (A, B, C, D)
elif A-B+C+D == 7:
    print '%s-%s+%s+%s=7' % (A, B, C, D)
elif A+B-C-D == 7:
    print '%s+%s-%s-%s=7' % (A, B, C, D)
elif A-B+C-D == 7:
    print '%s-%s+%s-%s=7' % (A, B, C, D)
elif A-B-C+D == 7:
    print '%s-%s-%s+%s=7' % (A, B, C, D)
elif A-B-C-D == 7:
    print '%s-%s-%s-%s=7' % (A, B, C, D)
n = int(input())
s = input()
x = []
import string
a = list(string.ascii_uppercase)
for i in s:
    b = a.index(i)
    x.append(a[b + n])
    
print(''.join(x))

### FIXED CODE ###

n = int(input())
s = input()
x = []
import string
a = list(string.ascii_uppercase)*2
#print(a)
for i in s:
    j = 0
    b = a.index(i)
    j = b + n
    x.append(a[j])
    
print(''.join(x))
a ,b = map(int,input().split())

if a <=b:print(“unsafe”)
else:print(“safe”)


### FIXED CODE ###

s, w = map(int, input().split())

if s>w: print('safe')
else: print('unsafe')
# -*- coding: utf-8 -*-       

s = input()
t = input()
ansstr = []

for i in range(len(s)-len(t)+1):
    p = len(s)-len(t)-i
    tmpstr = s[p:p+len(t)]
    flg = True
    for j in range(len(t)):
        if(tmpstr[j] == '?'):
            pass
        elif(tmpstr[j] == t[j]):
            pass
        else:
            flg = False
    if(flg):
        for k in range(len(s)):
            if(p<=k and k<p+len(t)):
                ansstr += t[k-p]
            elif(s[k]=='?'):
                ansstr += 'a'
            else:
                ansstr += s[k]
        break
print(''.join(ansstr) if flg else 'UNRESTORABLE')
                

### FIXED CODE ###

# -*- coding: utf-8 -*-       

s = input()
t = input()
ansstr = []

if(len(s)<len(t)):
    flg = False
for i in range(len(s)-len(t)+1)[::-1]:
    tmpstr = s[i:i+len(t)]
    flg = True
    for j in range(len(t)):
        if(tmpstr[j] == '?'):
            pass
        elif(tmpstr[j] == t[j]):
            pass
        else:
            flg = False
    if(flg):
        uset = list(range(i,i+len(t)))
        for k in range(len(s)):
            if(k in uset):
                ansstr += t[k-i]
            elif(s[k]=='?'):
                ansstr += 'a'
            else:
                ansstr += s[k]
        break
print(''.join(ansstr) if flg else 'UNRESTORABLE')