Harryxun/stf_run huggingface dataset:
import itertools
import numpy as np

N, K = input()
que = input()
try:
    N = int(N)
except:
    pass
try:
    K = int(K)
except:
    pass



que = [int(x) for x in que.split()]

#print(que)
"""
tmp = []
for x in que:
    for xx in range(K):
        tmp.append(x)
que = tmp
"""
min_val = 999999999

for x in itertools.combinations(que, K):
    tmp = np.sum(x)
    if tmp < min_val:
        min_val = tmp

print(min_val)


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.

Author : Takeshi Saga

"""

import itertools
import numpy as np

tmp = input()
#tmp = "5 3"
N,K = tmp.split()
que = input()
#que = "50 100 80 120 80"
try:
    N = int(N)
except:
    pass
try:
    K = int(K)
except:
    pass



que = [int(x) for x in que.split()]

#print(que)
"""
tmp = []
for x in que:
    for xx in range(K):
        tmp.append(x)
que = tmp
"""
min_val = 999999999

que = sorted(que)

#for x in itertools.combinations(que, K):

x = [que[i] for i in range(K)]
min_val = np.sum(x)

print(min_val)
from sympy import nextprime
N = int(input())
print(nextprime(N-1))



### FIXED CODE ###

X = int(input())

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(100100)

for i in prime_list:
    if X <= i:
        print(i)
        exit()
6 8
1 2
2 3
3 4
4 5
5 1
1 4
1 5
4 6
1 6


### FIXED CODE ###

n, m = map(int, input().split())

graph1 = [[] for _ in range(n*3)]

for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph1[u*3+0].append(v*3+1)
    graph1[u*3+1].append(v*3+2)
    graph1[u*3+2].append(v*3+0)

s, t = map(int, input().split())
s -= 1
t -= 1
s = s*3
t = t*3

from heapq import heappush, heappop
def dijkstra(graph:list, node:int, start:int) -> list:
    # graph[node] = [(cost, to)]
    inf = float('inf')
    dist = [inf]*node

    dist[start] = 0
    heap = [(0,start)]
    NextCost = 1
    while heap:
        cost,thisNode = heappop(heap)
        for NextNode in graph[thisNode]:
            dist_cand = dist[thisNode]+NextCost
            if dist_cand < dist[NextNode]:
                dist[NextNode] = dist_cand
                heappush(heap,(dist[NextNode],NextNode))
    return dist
    # dist = [costs to nodes]

inf = float('inf')
dist = dijkstra(graph1, n*3, s)
if dist[t] == inf:
    print(-1)
else:
    print(dist[t]//3)
a, b = [int(i) for i in input().split()]
c = []
for i in range(a):
    c.append(int(input()))

c.sort()

temp = 99999999
for a in range(len(c) - b + 1):
    if c[a + 2] - c[a] < temp:
        temp = c[a + 2] - c[a]

print(temp)

### FIXED CODE ###

a, b = [int(i) for i in input().split()]
c = []
for i in range(a):
    c.append(int(input()))

c.sort()

temp = 999999999999999999999999999999999999999999999999999999999999999999999999999999999
for a in range(len(c) - b + 1):
    s = c[a + b - 1]
    t = c[a]
    if s - t < temp:
        temp = s - t

print(temp)
D,T,S = map(int, input().split())


if T-D/S>= 0:
    print("Yes")
  else:
    print("No")
    


### FIXED CODE ###

D,T,S = map(int, input().split())

if T-D/S >= 0:
    print("Yes")
else:
    print("No")
from collections import Counter
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
c = Counter((y[0] - x[0], y[1] - x[1]) for x in a for y in a if x < y)
print(n - max(c.values()))


### FIXED CODE ###

from collections import Counter
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
c = Counter((y[0] - x[0], y[1] - x[1]) for x in a for y in a if x < y)
print(n - max(c.values(), default=0))
a = list(map(int, input().split()))
#print(a)
b=[0]*a[1]
c=[0]*(a[1]+1)
b[0]=int(input())
c[0]=b[0]-0
for x in range(a[1]-1):
    b[x+1]=int(input())
    c[x+1]=b[x+1]-b[x]-1
c[-1]=a[0]-b[-1]
max = 0
min = a[0]+100
for x in c:
    if x>max:
        max=x
    if x<min:
        min=x
        
#print(c)
#print(max," ",min)
if min==0:
    print(0)
else:
    num=[0]*(max)
    for x in range(max):
        if x==0:
            num[0]=1
        elif x==1:
            num[1]=1
        else:
            num[x]=(num[x-1]+num[x-2])%1000000007
        #print("num[",x,"]=",num[x])
        
    answer=1
    for x in c:
        answer *=num[x-1]
        if answer==0:
            print(0)
            break
        else:
            answer%=1000000007
    print(answer)

### FIXED CODE ###

n,m = list(map(int, input().split()))
a=[]
a.append(-1)
for x in range(m):
  tmp=int(input())
  a.append(tmp)
a.append(n+1)
diff = []
for x in range(len(a)-1):
  diff.append(a[x+1]-a[x])
              
large = 0
small = 123456789012345
for x in diff:
  large=max(large,x)
  small=min(small,x)

num=[0,0,1]
for _ in range(large):
  num.append((num[-1]+num[-2])%1000000007)
    
answer=1
for x in diff:
  #print(x,num[x])
  answer *=num[x]
  answer%=1000000007
print(answer)
'''
2
10 30
'''
lens = int(input())
arrs = [1/int(x) for x in input().split()]
print(1/arrs)

### FIXED CODE ###

lens = int(input())
arrs = sum([1/int(x) for x in input().split()])
if arrs != 0:
  print(1/arrs)
a,b,x = map(int,input().split())
def f(p):
    q = p//x
ans = f(b) - f(a-1)
print(ans)

### FIXED CODE ###

a,b,x = map(int,input().split())
def f(p):
    q = p//x
    return q
ans = f(b) - f(a-1)
print(ans)
s=int(input())
n=len(s)
now=0
for i in range(n):
  if s[i]=="o":
    now+=1
if now<n-7:
  print("NO")
else:
  print("YES")

### FIXED CODE ###

s=input()
n=len(s)
now=0
for i in range(n):
  if s[i]=="o":
    now+=1
if now + 15 - n >= 8:
  print("YES")
else:
  print("NO")
N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
b=''
a='no'
for i in range(M):
    b+=B[i]
for i in range(N-M+1):
    if B[0]in A[0] and B[1] in A[1]:
        for j in range(N-M+1):
            a=''
            for k in range(M):
                a+=A[i+k][j:j+M]
    if a==b:
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
b=''
a='no'
for i in range(M):
    b+=B[i]
for i in range(N-M+1):
    if B[0]in A[i] :
        for j in range(N-M+1):
            a=''
            for k in range(M):
                a+=A[i+k][j:j+M]
            if a==b:
                print("Yes")
                exit()
print("No")
n, a = map(int,input().split())
 
r = n%500
if r > a:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

N = int(input())
A = int(input())

r = N % 500
if r > A:
    print("No")
else:
    print("Yes")
x = input()

y = x**3

print int(y)

### FIXED CODE ###

x = int(input())

print(x*x*x)
A = []
for i in range(3):
    p,q,r = map(int, input().split())
    A.append(p)
    A.append(q)
    A.append(r)
n = int(input())
for i in range(n):
    b = int(input())
    if b in A:
        A[A.index(b)] = 0

if A[0]==A[1]==A[2]==0 or A[3]==A[4]==A[5]==0 or A[6]==A[7]==A[9]==0 or A[0]==A[3]==A[6]==0 or A[1]==A[4]==A[7]==0 or A[2]==A[5]==A[8]==0 or A[0]==A[4]==A[8]==0 or A[2]==A[4]==A[6]==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

A = []
for i in range(3):
    p,q,r = map(int, input().split())
    A.append(p)
    A.append(q)
    A.append(r)
n = int(input())
for i in range(n):
    b = int(input())
    if b in A:
        A[A.index(b)] = 0

if A[0]==A[1]==A[2]==0 or A[3]==A[4]==A[5]==0 or A[6]==A[7]==A[8]==0 or A[0]==A[3]==A[6]==0 or A[1]==A[4]==A[7]==0 or A[2]==A[5]==A[8]==0 or A[0]==A[4]==A[8]==0 or A[2]==A[4]==A[6]==0:
    print("Yes")
else:
    print("No")
n,a,b=map(int,input())
print(n*min(a,b))

### FIXED CODE ###

n,a,b=map(int,input().split())
print(min(n*a,b))
n,q=map(int,input().split())
s=input()
places=[]
moves=[]
for _ in range(q):
  p,m=map(str,input().split())
  places.append(p)
  moves.append(m)
l=-1
r=n
while r-l!=1:
  mid=(l+r)//2
  p=mid
  for i in range(q):
    if s[p]==places[i]:
      if moves[i]=='L':
        p-=1
      if moves[i]=='R':
        p+=1
      if p<0 or p>=n:
        l=mid
        break
  else:
    r=mid
remain_left=r
l=remain_left
r=n
while r-l!=1:
  mid=(l+r)//2
  p=mid
  for i in range(q):
    if s[p]==places[i]:
      if moves[i]=='L':
        p-=1
      if moves[i]=='R':
        p+=1
      if p<0 or p>=n:
        r=mid
        break
  else:
    l=mid
remain_right=l
print(remain_right-remain_left+1)

### FIXED CODE ###

def remain(pos,length):
  p=pos
  for c,d in moves:
    if s[p]==c:
      if d=='L':
        p-=1
      if d=='R':
        p+=1
    if p<0 or p>=length:
      return False
  return True

n,q=map(int,input().split())
s=input()
moves=[list(map(str,input().split())) for _ in range(q)]
l=-1
r=n
while r-l!=1:
  mid=(l+r)//2
  if remain(mid,n)==True:
    r=mid
  else:
    l=mid
remain_left=r
if remain_left==n:
  print(0)
  exit()
l=remain_left
r=n
while r-l!=1:
  mid=(l+r)//2
  if remain(mid,n)==True:
    l=mid
  else:
    r=mid
remain_right=l
print(remain_right-remain_left+1)
s = input()
ans = ""
for i in s
  if i == "B":
    if len(ans) > 0:
      ans = ans[:-1]
    else:
      ans = ans
  else:
    ans = ans + c
print(ans)

### FIXED CODE ###

s = input()
ans = ""
for i in s:
  if i == "B":
    if len(ans) > 0:
      ans = ans[:-1]
  else:
    ans = ans + i
print(ans)
n=input()
a=len(b)
b=0
for i in range(a):
  b=b+int(n[i])
if b%9==0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n=input()
a=len(n)
b=0
for i in range(a):
  b=b+int(n[i])
if b%9==0:
  print("Yes")
else:
  print("No")
import numpy as np
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
A=np.array(A)
for _ in range(Q):
  B,C=map(int,input().split())
  A[A==B]=C
  print(sum(A))


### FIXED CODE ###

a=str(input())
if a.isupper():
    print("A")
else:
    print("a")
a= int(input())
print(a//3600+':'+(a%3600)//60+':'+(a%3600)%60)


### FIXED CODE ###

a= int(input())
h = a//3600
m = (a%3600)//60
s = (a%3600)%60
print('%d:%d:%d' % (h, m, s))
a, p = map(int, input().split())
print((a * 3 + p) / 2)


### FIXED CODE ###

a, p = map(int, input().split())
print((a * 3 + p) // 2)
a,b = map(int,input(),split())
if a*b % 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")
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fib={0:0,1:1,2:1}
for i in range(3,100003):
    fib[i]=fib[i-1]+fib[i-2]
  #  fib.append(fib[i-1]+fib[i-2])

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
l=[a[0]]
for i in range(len(a)-1):
    l.append(a[i+1]-a[i]-1)
l.append(n-a[-1])
k=1
for i in l:
    k=fib[i]*k%mod
print(k%mod)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fib={0:0,1:1,2:1}
for i in range(3,100003):
    fib[i]=fib[i-1]+fib[i-2]
  #  fib.append(fib[i-1]+fib[i-2])

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
if m!=0:
    l=[a[0]]
    for i in range(len(a)-1):
        l.append(a[i+1]-a[i]-1)
    l.append(n-a[-1])
    k=1
    for i in l:
        k=fib[i]*k%mod
    print(k%mod)
else:
    print(fib[n+1]%mod)
import math

r = int(input())
a = r * r * math.pi
b = r * 2 * math.pi
print('{0:f} {1:f}'.format(a, b))

### FIXED CODE ###

import math

r = float(input())
a = r * r * math.pi
b = r * 2 * math.pi
print('{0:f} {1:f}'.format(a, b))
ab, bc, ca = map(int, raw_input().split())
area = ab * bc / 2
print(area)

### FIXED CODE ###

ab, bc, ca = map(int, input().split())
area = int(ab * bc / 2)
print(area)
x,n=map(int,input().split())
if(n!=0):
    a = list(map(int,input().split()))
else:
    print(x)
flag=True
k = 0

while(True):
    b = x - k
    c = x + k
    if(not(b in a)):
        print(b)
        break
    elif(not(c in a)):
        print(c)
        break
    k = k + 1

### FIXED CODE ###

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

flag=True
k = 0

while(True):
    b = x - k
    c = x + k
    if(not(b in a)):
        print(b)
        flag = False
        break
    elif(not(c in a) and flag):
        print(c)
        break
    k = k + 1
import math
a, b, c, d = map(int, input().split())
if math.ceil(c / b) =< math.ceil(a / d):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

import math
a, b, c, d = map(int, input().split())
if math.ceil(c / b) <= math.ceil(a / d):
  print("Yes")
else:
  print("No")
n = int(input())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else:
        x /= 10
        while x > 0 :
        if x % 10 == 3:
            ret += " " + str(i)
            x /= 10
    i+=1
    if i > n:
        break

print(ret)



### FIXED CODE ###

#
# 5d
#

def main():
    n = int(input())
    s = ""
    for i in range(1, n+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            s += " " + str(i)
        else:
            x //= 10
            while x:
                if x % 10 == 3:
                    s += " " + str(i)
                    break
                x //= 10
    print(s)


if __name__ == '__main__':
    main()
n = int(input())
a = []
for i in range(5):
    inp = int(input())
    a.append(inp)

mini = min(a)
if n > mini:
    add = (int(n /10)*10) / mini
    n -= int(add*mini)
    #print(n)
num = [n]

for i in range(5):
    num.append(0)
    
count =0
while True:
    non_zero = [i for i in range(5) if num[i] !=0] 
    #print(non_zero)
    for i in reversed(non_zero):
        #print("i {}".format(i))
        move = min(a[i], num[i])
        num[i] -= move
        num[i+1] += move
    count +=1
   
    #print(num)
    #print(count)
    if num[-1]==n:
        break
print(int(count+add))

### FIXED CODE ###

import numpy as np
n = int(input())
a = []
for i in range(5):
    tmp = int(input())
    a.append(tmp)

print(int(np.ceil(n / min(a)) +4))
s, t = input.split()
a, b = input.split()
u = input()

if u == s:
    print(a-1, b)
if u == t:
    print(a, b-1)

### FIXED CODE ###

s, t = input().split()
a, b = input().split()
u = input()

a = int(a)
b = int(b)

if u == s:
    print(a-1, b)
if u == t:
    print(a, b-1)
A, B = map(int, input().split())
if A >= 13:
  print(B)
else A >= 6:
  print(B//2)
else:
  print(0)

### FIXED CODE ###

A, B = map(int, input().split())
if A >= 13:
  print(B)
elif A >= 6:
  print(B//2)
else:
  print(0)
n, k = map(int, input().split())
nums = list(map(int, input().split()))
 
sum_max = sum(nums[:k])
for i in range(k,n):
  temp -=nums[i-k]
  temp +=nums[i]
  sum = max(temp, sum)
print((sum_max +k)/2)

### FIXED CODE ###

n, k = map(int, input().split())
nums = list(map(int, input().split()))
 
sum_max = sum(nums[:k])
temp = sum_max
for i in range(k,n):
  temp -= nums[i-k]
  temp += nums[i]
  sum_max = max(temp, sum_max)
print((sum_max +k)/2)
from sys import stdin
readline = stdin.readline

v, e = map(int, readline().split())
from collections import defaultdict
g = defaultdict(list)

for _ in range(e):
    s, t = map(int, readline().split())
    g[s].append(t)
    g[t].append(s)
    
visited = set()
lowest = [None] * v
parent = [None] * v
prenum = [None] * v
child = defaultdict(list)
root = 0

# dfs??§tree?????????
stack = [(root, None)]
while stack:
    u, prev = stack.pop()
    if u not in visited:
        parent[u] = prev
        if prev is not None:
            child[prev].append(u)
    visited |= {u}
    prenum[u] = lowest[u] = len(visited)
    
    stack.extend([(v, u) for v in g[u] if v not in visited])
            
leaf = [i for i in range(v) if not child[i]]
for li in leaf:
    while li is not None:
        candidate = [prenum[li]] + [prenum[i] for i in g[li] if i != parent[li]] + [lowest[i] for i in child[i]]
        lowest[li] = min(candidate)
        li = parent[li]

if 2 <= len(child[root]):
    print(root)
for i in range(1, v):
    if child[i] and any(prenum[i] <= lowest[j] for j in child[i]):
        print(i)

### FIXED CODE ###

from sys import stdin
readline = stdin.readline


def main():
    v, e = map(int, readline().split())
    from collections import defaultdict
    g = defaultdict(list)

    for _ in range(e):
        s, t = map(int, readline().split())
        g[s].append(t)
        g[t].append(s)

    visited = set()
    lowest = [None] * v
    parent = [None] * v
    prenum = [None] * v
    child = defaultdict(list)
    root = 0

    # dfs??§tree?????????
    stack = [(root, None)]
    while stack:
        u, prev = stack.pop()
        if u not in visited:
            parent[u] = prev
            if prev is not None:
                child[prev].append(u)
            visited |= {u}
            prenum[u] = lowest[u] = len(visited)

        stack.extend([(v, u) for v in g[u] if v not in visited])

    # lowest????¨????
    from collections import Counter
    leaf = [i for i in range(v) if not child[i]]
    unfinished = Counter()
    for li in leaf:
        while li is not None:
            candidate = [prenum[li]] + [prenum[i] for i in g[li] if i != parent[li]] + [lowest[i] for i in child[li]]
            lowest[li] = min(candidate)
            li = parent[li]
            if li is not None and 1 < len(child[li]):
                unfinished[li] += 1
                if unfinished[li] < len(child[li]):
                    break

    # ??£???????????????
    if 2 <= len(child[root]):
        print(root)
    for i in range(1, v):
        if child[i] and any(prenum[i] <= lowest[j] for j in child[i]):
            print(i)
main()
n,k=map(int,input().split())
a=list(map(int,input().split()))

#n=6
#k=727202214173249351
#a=[6, 5, 2, 5, 3, 2]

#n=4
#k=5
#a=[3,2,4,1]

#if n<k:
if 1==1:
    ai=1
    aj=set()
    for i in range(min(n,k)):
        aim=ai
        ai=a[ai-1]
        if ai in aj:
            ic2=i
            ai2=ai
            break
        else:
            aj.add(ai)

    ai=1
    for i in range(min(n,k)):
        ai=a[ai-1]
        if ai==ai2:
            ic1=i
            break

    icyc=ic2-ic1
    k2=(k-ic1)%icyc+ic1
else:
    ic1=0
    icyc=1
    k2=k
    
ai=1
for i in range(k2):
    ai=a[ai-1]
        
print(ai)



### FIXED CODE ###

import sys

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

for i in range(n):
    a[i]-=1
#print(a)

if k<=n:
    b=0
    for i in range(k):
        b=a[b]
    print(b+1)
    sys.exit()
    
b=0
c=[-1]*n
c[0]=0
for i in range(n):
#   print(b,a[b])
   b=a[b]
   if c[b]>=0:
#       print("i:",i)
       break
   else:
       c[b]=i+1

ki=c[b]+1
kc=(i+1)-c[b]
k2=(k-ki)%kc+ki
#print("ki:",ki,"kc:",kc,"k2:",k2)
b=0
for i in range(k2):
    b=a[b]
print(b+1)
x = input()
x = x.split()
x = x.split('\n')
k = int(x[0])
a = int(x[1])
b = int(x[2])
if k <= b - a:
  print('OK')
else:
  if b % k <= a % k:
    print('OK')
  else:
    print('NG')


### FIXED CODE ###

k = int(input())
a,b = map(int,input().split())
if k <= b - a:
  print('OK')
else:
  if b // k > a // k or a % k == 0:
    print('OK')
  else:

    print('NG')
## coding: UTF-8
from fractions import gcd
s = input().split()
t = [int(p) for p in s]
#print(t)

A = t[0]
B = t[1]
C = t[2]

print(A)
print(B)
Gcd = math.gcd(A, B)
print(Gcd)

print(C)

if(C % Gcd == 0):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

## coding: UTF-8
from fractions import gcd
s = input().split()
t = [int(p) for p in s]
#print(t)

A = t[0]
B = t[1]
C = t[2]

#print(A)
#print(B)
Gcd = gcd(A, B)
#print(Gcd)

#print(C)

if(C % Gcd == 0):
    print("YES")
else:
    print("NO")
def fac(x):
    if x==1:return 0
    return fac(x-1)+x-1

from collections import Counter
c=Counter()
N=int(input())
A=list(map(int,input().split()))
l=len(A)
t=[]
d={}
for i in range(l):
    t=A.copy()
    del t[i]
    d=dict(Counter(t))
    s=0
    for value in d.values():
        if value>=2:
            s=s+fac(value)
    print(s)




### FIXED CODE ###



from collections import Counter
N=int(input())
A=list(map(int,input().split()))
d=dict(Counter(A))
sum=0
s=[]
s.append(0)
for i in range(1,2*10**5+1):
    s.append(s[i-1]+i-1)
for value in d.values():
    sum+=s[value]
for x in A:
    print(sum-(d[x]-1))
n, m = map(int, input().split())
lst = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    lst[x].append(y)
print(lst)

def rec_dp(x):
    global dp
    if dp[x] != -1:
        return dp[x]
    else:
        ans = 0
        for y in lst[x]:
            ans = max(ans, rec_dp(y) + 1)
        dp[x] = ans
        return dp[x]
      
dp = [-1] * n
ans = 0
for _ in range(n):
    ans = max(ans, rec_dp(_))
print(ans)

### FIXED CODE ###

import sys

sys.setrecursionlimit(20000)

n, m = map(int, input().split())
lst = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    lst[x].append(y)

def rec_dp(x):
    global dp
    if dp[x] != -1:
        return dp[x]
    else:
        ans = 0
        for y in lst[x]:
            ans = max(ans, rec_dp(y) + 1)
        dp[x] = ans
        return dp[x]
      
dp = [-1] * n
ans = 0
for _ in range(n):
    ans = max(ans, rec_dp(_))
print(ans)
s,w=map(int, input().split())
if w>=s:
  pritn('unsafe')
else:
  print('safe')

### FIXED CODE ###

s,w=map(int, input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')
#!/usr/bin/env python

def q_sort(a):
        if len(a)==1:
                return a
        pivot  = a[len(a)/2]
        return q_sort([i for i in a if i < pivot ]) + [pivot] + q_sort([i for i in a if pivot < i])



n = int( raw_input() )
array =  [ int(i) for i in raw_input().split(" ") ]
for i in q_sort(array):
        print "%d"%i,
print "\n",

### FIXED CODE ###

#!/usr/bin/env python

import random



def get_2nd(a,b,c):
        l = [a,b,c]
        l.sort()
        return l[1]

def q_sort(a):
        if a==[]:
                return []
        l = len(a)
        pivot = get_2nd(a[0],a[l/2],a[l-1])
        return q_sort([i for i in a if i < pivot ]) + [i for i in a if i == pivot ] + q_sort([i for i in a if pivot < i])



n = int( raw_input() )
array =  [ int(i) for i in raw_input().split(" ") ]
random.shuffle(array)
for i in q_sort(array):
        print i,
x, y = map(int, input().split())

ans = 'No'

for i in range(x + 1):
    j = x - a
    if (j*2 + i*4 == y):
        ans = "Yes"
print(ans)


### FIXED CODE ###

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

ans = 'No'

for i in range(x + 1):
    j = x - i
    if (j*2 + i*4 == y):
        ans = "Yes"
print(ans)
import math
X, Y = map(int, input().split())

if (X*2 - Y)%3 != 0 or (Y*2 - X)%3 != 0:
    print(0)
    exit()
else:
    X, Y = (X*2 - Y)//3, (Y*2 - X)//3
    waru = 1000000007
    Xfac = math.factorial(X)
    Yfac = math.factorial(Y)
    XYfac = math.factorial(X+Y)
    p = (XYfac // Xfac // Yfac) % waru
    print(p)

### FIXED CODE ###

import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    X, Y = NMI()
    if (2*Y - X)%3 or (2*X - Y)%3:
        print(0)
        exit()

    A = (2*Y - X) // 3
    B = (2*X - Y) // 3
    if A < 0 or B < 0:
        print(0)
        exit()
    print(combinations_mod(A+B, A))


if __name__ == "__main__":
    main()
s=input()

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

### FIXED CODE ###

s = input()

for bit in range(1 << 3):
    ans = int(s[0])
    f = s[0]

    for i in range(3):
        # フラグが立っていれば "+" 、なければ "-"
        if bit & (1 << i):
            ans += int(s[i + 1])
            f += "+"
        else:
            ans -= int(s[i + 1])
            f += "-"
        f += s[i + 1]

    if ans == 7:
        print(f + "=7")
        exit()