Harryxun/stf_run huggingface dataset:
import itertools

dx = (0, 0, 0, 1,-1, 1, 1,-1,-1,-2, 2, 0, 0)
dy = (0, 1,-1, 0, 0, 1,-1, 1,-1, 0, 0,-2, 2)
dd = (5, 9, 13)

def drop(fab, used, size_list):
    for xy in range(100):
        y = xy%10
        x = xy//10
        size = size_list[used]
        check = True
        for i in range(size):
            if fab[y + dy[i] + 2][x + dx[i] + 2] == 0:
                check = False
                break
        if check:
            for i in range(size):
                fab[y + dy[i] + 2][x + dx[i] + 2] -= 1
            if sum(map(sum, fab)):
                result = drop(fab, used + 1, size_list)
                if result:
                    result.append([x, y, dd.index(size) + 1])
                    return result
                for i in range(size):
                    fab[y + dy[i] + 2][x + dx[i] + 2] += 1
            else:
                return [[x, y, dd.index(size) + 1]]
    return False

fab = [[0 for i in range(14)] for j in range(14)]

n = int(input())

for i in range(10):
    fab[i + 2][2:12] = list(map(int, input().split()))

s = sum(map(sum, fab))
d_all = list(itertools.combinations_with_replacement([5,9,13], n))
d_list = [l for l in d_all if sum(l) == s]

ans = [0 for i in range(n)]
for d in d_list:
    d_tmp = sorted(d)[::-1]
    ans = drop(fab, 0, d_tmp)
    if ans:
        for a in ans:
            print(*a)
        break



### FIXED CODE ###

import itertools

dx = (0, 0, 0, 1,-1, 1, 1,-1,-1,-2, 2, 0, 0)
dy = (0, 1,-1, 0, 0, 1,-1, 1,-1, 0, 0,-2, 2)
dd = (5, 9, 13)

def drop(fab, start, used, size_list):
    for xy in range(start, 100):
        y = xy%10
        x = xy//10
        size = size_list[used]
        for i in range(size):
            if not fab[y + dy[i] + 2][x + dx[i] + 2]:
                break
        else:
            for i in range(size):
                fab[y + dy[i] + 2][x + dx[i] + 2] -= 1
            if sum(map(sum, fab)):
                if size == size_list[used + 1]:
                    result = drop(fab, xy, used + 1, size_list)
                else:
                    result = drop(fab, 0, used + 1, size_list)
                if result:
                    result.append([x, y, dd.index(size) + 1])
                    return result
                for i in range(size):
                    fab[y + dy[i] + 2][x + dx[i] + 2] += 1
            else:
                return [[x, y, dd.index(size) + 1]]
    return False

fab = [[0 for i in range(14)] for j in range(14)]

n = int(input())

for i in range(10):
    fab[i + 2][2:12] = list(map(int, input().split()))

s = sum(map(sum, fab))
d_all = list(itertools.combinations_with_replacement([5,9,13], n))
d_list = [l for l in d_all if sum(l) == s]

ans = [0 for i in range(n)]
for d in d_list:
    d_tmp = sorted(d)[::-1]
    ans = drop(fab, 0, 0, d_tmp)
    if ans:
        for a in ans:
            print(*a)
        break
class coordinates:
  def __init__(self, x, y):
    self.x = x
    self.y = y

def koch(n, a, b):
  if n == 0:
    return
  s = coordinates((2*a.x + b.x)/3, (2*a.y + b.y)/3)
  t = coordinates((a.x + 2*b.x)/3, (a.y + 2*b.y)/3)
  ux = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
  uy = (t.x - s.y)*sin(pi/3) + (t.y - s.y)*cos(pi/3) + s.y
  u = point(ux, uy)
 
  koch(n-1, a, s)
  print  s.x, s.y
  koch(n-1, s, u)
  print  u.x, u.y
  koch(n-1, u, t)
  print  t.x, t.y
  koch(n-1, t, b)
 
n = input()
 
p1 = point(0.0, 0.0)
p2 = point(100.0, 0.0)
 
print p1.x, p1.y
koch(n, p1, p2)
print p2.x, p2.y

### FIXED CODE ###

import math

rad = math.radians(60)

class coordinates:
  def __init__(self, x, y):
    self.x = x
    self.y = y
 
def koch(n, a, b):
  if n == 0:
    return
  s = coordinates((2.0*a.x + b.x)/3.0, (2.0*a.y + b.y)/3.0)
  t = coordinates((a.x + 2.0*b.x)/3.0, (a.y + 2.0*b.y)/3.0)
  ux = (t.x - s.x)*math.cos(rad) - (t.y - s.y)*math.sin(rad) + s.x
  uy = (t.x - s.x)*math.sin(rad) + (t.y - s.y)*math.cos(rad) + s.y
  u = coordinates(ux, uy)
  
  koch(n-1, a, s)
  print  s.x, s.y
  koch(n-1, s, u)
  print  u.x, u.y
  koch(n-1, u, t)
  print  t.x, t.y
  koch(n-1, t, b)
  
n = input()
  
p1 = coordinates(0.0, 0.0)
p2 = coordinates(100.0, 0.0)
  
print p1.x, p1.y
koch(n, p1, p2)
print p2.x, p2.y
while True:
    x,y = map(int,input().split())
    if x > y:
        print(f"{y} {x}")
    elif x <= y:
        print(f"{x} {y}")
    elif x == 0 and y == 0:
        break


### FIXED CODE ###

while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    if x > y:
        print(f"{y} {x}")
    elif x <= y:
        print(f"{x} {y}")
n = int(input())
ans = n
for i in range(1,int(n**0.5)):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)


### FIXED CODE ###

n=int(input())
ans=n
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        ans=n//i+i-2
        break
print(ans)
# ABC113 C
N, M = map(int, input().split())
cities = [list(map(int, input().split())) for _ in range(M)]

cities = [[*city, i] for i, city in enumerate(cities)]
city_count = [0]*(M+1)
cities.sort(key=lambda x: x[1])
ids = []
for city in cities:
    city_count[city[0]] += 1
    ids.append(['{:0>6}{:0>6}'.format(city[0], city_count[city[0]]), city[2]])
ids.sort(key=lambda x: x[1])
for city in ids:
    print(city[0])

### FIXED CODE ###

# ABC113 C
N, M = map(int, input().split())
cities = [list(map(int, input().split())) for _ in range(M)]

cities = [[i, city[0], city[1]] for i, city in enumerate(cities)]
city_count = [0]*(N+1)
cities.sort(key=lambda x: x[2])
ids = []
for city in cities:
    city_count[city[1]] += 1
    ids.append([city[0], '{:0>6}{:0>6}'.format(city[1], city_count[city[1]])])
ids.sort(key=lambda x: x[0])
for city in ids:
    print(city[1])
n = int(input())
S = list(input() for _ in range(n))

def intersect_list(l1, l2):
  arr = []
  lst = l1.copy()
  for element in l2:
    try:
      lst.remove(element)
    except ValueError:
      pass
    else:
      arr.append(element)
  return arr

l = intersect_list(list(S[0]), list(S[1]))
for i in range(2, n):
  l = intersect_list(l, list(S[i]))

l.sort()
print("".join(l))

### FIXED CODE ###

from collections import Counter

N = int(input())
counter = [Counter(input()) for _ in range(N)]

c = counter[0]
for i in range(1, N):
  for k, v in c.items():
    c[k] = min(counter[i][k], c[k])

c = sorted(c.items())
ans = ""
for k, v in c:
  ans += k * v
print(ans)
a=map(int,input().split())
a.sort()
print(1 if a[0]==a[2] else 2 if a[0]==a[1] or a[1]==a[2] else 3)

### FIXED CODE ###

a=list(map(int,input().split()))
a.sort()
print(1 if a[0]==a[2] else 2 if a[0]==a[1] or a[1]==a[2] else 3)
import math

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

  right = []
  left  = []

  right.append(a[0])
  left.append(a[-1])

  for i in range(1, len(a)-1):
    right.append(math.gcd(right[i-1], a[i]))
    left.append(math.gcd(left[i-1], a[len(a)-i-1]))
  
  ans = max(right[-1], left[-1])
  
  for i in range(len(right)-1):
    ans = max(ans, math.gcd(right[0], left[-2-i]))
    
  print(ans)
  
main()

### FIXED CODE ###

import fractions

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

  right = []
  left  = []

  right.append(a[0])
  left.append(a[-1])

  for i in range(1, len(a)-1):
    right.append(fractions.gcd(right[i-1], a[i]))
    left.append(fractions.gcd(left[i-1], a[-i-1]))
  
  ans = max(right[-1], left[-1])
  
  for i in range(len(right)-1):
    ans = max(ans, fractions.gcd(right[i], left[-i-2]))
    
  print(ans)
  
main()
s = input()
t = input()
minCount = 100000000
i = 0
while i < len(s) and i + j < len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)


### FIXED CODE ###

s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)
#encoding:utf-8

import numpy as np
import sys
sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
S = []
for i in range(H):
    s = list(input())
    S.append(s)

S_ = np.array(S)

def count_answer(x,y,num_b,num_w):
    # print(used)
    # global num_b,num_w
    count = 0
    dx = [0,0,1,-1]
    dy = [1,-1,0,0]
    # print("x,y:",x,y)
    for i in range(4):
        next_x = x + dx[i]
        next_y = y + dy[i]
        # print(next_x,next_y)
        used[next_x][next_y] = 1
        if next_x == -1 or next_y == -1:
            pass
        elif next_x >= H or next_y >= W:
            pass
        elif used[next_x][next_y] == 1:
            pass
        elif S_[next_x][next_y] != S_[x][y]:
            if S_[next_x][next_y] == "#":
                num_b += 1
            else:
                num_w += 1
            num_b,num_w = count_answer(next_x,next_y,num_b,num_w)
    return num_b,num_w

answer = 0
used = np.zeros((H,W))
for i in range(H):
    for j in range(W):
        if used[i][j] == 1:
            pass
        elif S_[i,j] == "#":
            num_b = 0
            num_w = 0
            num_b,num_w  = count_answer(i,j,num_b,num_w)
            answer += num_b*num_w
print(answer)


### FIXED CODE ###

#encoding:utf-8

import numpy as np
import sys
sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
S = []
for i in range(H):
    s = list(input())
    S.append(s)


def count_answer(x,y,num_b,num_w):
    # print(used)

    if S[x][y] == "#":
        num_b += 1
    else:
        num_w += 1
    used[x][y] = 1
    dx = [0,0,1,-1]
    dy = [1,-1,0,0]
    # print("x,y:",x,y)
    for i in range(4):
        next_x = x + dx[i]
        next_y = y + dy[i]
        # print(next_x,next_y)
        if next_x == -1 or next_y == -1 or next_x >= H or next_y >= W:
            pass
        elif used[next_x,next_y] == 1:
            pass
        elif S[next_x][next_y] != S[x][y]:
            num_b,num_w = count_answer(next_x,next_y,num_b,num_w)
    return num_b,num_w

answer = 0
used = np.zeros((H,W))
for i in range(H):
    for j in range(W):
        if used[i][j] == 1:
            continue
        num_b = 0
        num_w = 0
        if S[i][j] == "#":
            num_b,num_w  = count_answer(i,j,num_b,num_w)
            answer += num_b*num_w
print(answer)
n = int(input())
A = map(int, input().split())
import numpy as np
A = np.array(A)
B = []
for i in range(n):
    b = np.where(A==i+1)
    print(b[0][0]+1)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
B = [0]*n
for i in range(n):
  B[A[i]-1] = i + 1 
for i in range(n):
  print(B[i])
x,k,d = map(int, input().split())
lists = []
i = 0
 

if k*d <= x:
  answer = x - k*d
else:
  while i * d <= x and i <= d:
    answer = min(abs(i*d-x),i*d+x)
    i += 1


print(answer)

### FIXED CODE ###

x,k,d = map(int, input().split())
lists = []
x = abs(x)

step = int(x/d) 

if step >= k:
  answer = x - k * d
elif step < k:
  k_left = k - int(step)
  if k_left % 2 == 0:
    answer = x % d
  if k_left % 2 == 1:
    answer = abs(x - step * d - d)

print(answer)
n, nq = map(int, input().split())

ss = [set([i]) for i in range(n)]

for _ in range(nq):
    q,x,y = map(int, input().split())
    if q == 0:
        sx = {}
        sy = {}
        for s in ss:
            if x in s:
                sx = s
            if y in s:
                sy = s
        ss.remove(sx)
        ss.remove(sy)
        ss.append(sx | sy)
    else:
        for s in ss:
            if x in s:
                if y in s:
                    print(1)
                else:
                    print(0)



### FIXED CODE ###

n, nq = map(int, input().split())
set_list = list(range(n))

def find(n):
    global set_list
    if set_list[n] == n:
        return n
    result = set_list[n] = find(set_list[n])
    return result

def same(x, y):
    set_list[find(y)] = find(x)

def unite(x, y):
    return find(x) == find(y)

for _ in range(nq):
    com,x,y = map(int, input().split())
    if com == 0:
        same(x, y)
    else:
        if unite(x, y):
            print(1)
        else:
            print(0)
X = int(input())

FIVES = [x ** 5 for x in range(200)]

for ki,vi in enumerate(FIVES):
    for kj,vj in enumerate(FIVES):
        if and vi - vj == X:
            print(ki,kj)
            exit()
        if vj - vi == X:
            print(kj,ki)
            exit()
        if vi + vj == X:
            print(ki+1,-(kj+1))
            exit()



### FIXED CODE ###

X = int(input())

FIVES = [x ** 5 for x in range(200)]

for ki,vi in enumerate(FIVES):
    for kj,vj in enumerate(FIVES):
        if vi - vj == X:
            print(ki,kj)
            exit()
        if vj - vi == X:
            print(kj,ki)
            exit()
        if vi + vj == X:
            print(ki,-kj)
            exit()
import math

def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	count = 1
	for i in range(2, math.ceil(math.sqrt(num))+ 1):
		if num % i == 0:
			count += 1
			while num%i == 0:
				num //= i
	if num > 1:
		count += 1
	print(count)	


if __name__ == "__main__":
	main()


### FIXED CODE ###

from fractions import gcd
import math
a,b = map(int,input().split())
n = gcd(a,b)
if n == 1:
    print(1)
    exit()
count = 1
for i in range(2,math.ceil(math.sqrt(n))+1):
    if n % i == 0:
        count += 1
        while n % i == 0:
            n //= i
if n > 1:
    count += 1
print(count)
import math
A = list(map(int, input().split()))
result  = math.factorial(A[0])/2/math.factorial(A[0]-2)+math.factorial(A[1])/2/math.factorial(A[1]-2)
print (result)

### FIXED CODE ###

import math
def com(a):
    if a == 0 or a == 1:
        return 0
    elif a == 2:
        return 1
    else:
        return math.factorial(a)/2/math.factorial(a-2)
A = list(map(int, input().split()))
result  = int(com(A[0])+com(A[1]))
print (result)
r=int(input())
g=int(input())
b=int(input())
d=r*100+g*10+b
if d%4==0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

r, g, b = map(str, input().split())
ans = r + g + b
# print(ans)
ans_i = int(ans)
 
if ans_i % 4 == 0:
    print('YES')
else:
    print('NO')
n, m, *a = map(int, open(0).read().split())

a = sorted(a, reverse=True)

for i in range (0,m):
  a[0] = a[0]//2
  if a[0] < a[1]:
    a = sorted(a, reverse=True)
    if a[0] == 0:
      break

print(sum(a))

### FIXED CODE ###

n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))
n,y = map(int,input().split())

or i in range(n+1):
    for j in range(n-i+1):
        print(i,j,n-i-j)
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
        print(-1,-1,-1)

### FIXED CODE ###

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

for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
print(-1,-1,-1)
def solution(N, K):
	x = 0
	if N%2:
      x = N/2
	else:
      x = (N-1) / 2
    return K<=x
N, K = [int(s) for s in input().split(' ')]
print(solution(N, K))

### FIXED CODE ###

N, K = [int(s) for s in input().split(' ')]
x = 0
if N%2:
    x = (N + 1) / 2
else:
    x = N/ 2
if x>=K:
    print("YES")
else:
    print("NO")
N=(input())
a = len(N)
if N%1000 ==0:
  print(0)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a==2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

### FIXED CODE ###

N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)
n, k = map(int, input().split())
h = list(map(int, input().split()))
print(len(filter(lambda x: x >= k, h)))


### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
print(len(list(filter(lambda x: x >= k, h))))
s=input()
t=input()
n=len(s)
m=len(t)
dp=[[0 for j in range(m+1)] for i in range(n+1)]
def lcs(i,j):
	if dp[i][j]!=0:
		return dp[i][j]
	if i*j==0:
		return 0
	if s[i-1]==t[j-1]:
		r=lcs(i-1,j-1)+1
	else:
		r=max(lcs(i,j-1),lcs(i-1,j))
	dp[i][j]=r
	return r
		
		

lcs(n,m)

i=n
j=m
st=""
while dp[i][j]:
	while dp[i-1][j]==dp[i][j]:
		i-=1
	while dp[i][j-1]==dp[i][j]:
		j=j-1
	j-=1
	st+=s[i-1]
	i-=1
print(st[::-1])
	

### FIXED CODE ###

s=input()
t=input()
n=len(s)
m=len(t)
dp=[[0 for j in range(m+1)] for i in range(n+1)]
for i in range(1,n+1):
	for j in range(1,m+1):
		if s[i-1]==t[j-1]:
			dp[i][j]=dp[i-1][j-1]+1
		else:
			dp[i][j]=max(dp[i-1][j],dp[i][j-1])
i=n
j=m
st=""
while dp[i][j]:
	while dp[i-1][j]==dp[i][j]:
		i-=1
	while dp[i][j-1]==dp[i][j]:
		j=j-1
	j-=1
	st+=s[i-1]
	i-=1
print(st[::-1])
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
for i in range(n-1):
    for j in range(i+1,n):
        if "1" not in bin(t)[3:]:
            ans+=1
print(len(ans))


### FIXED CODE ###

n=int(input())
a=[int(i) for i in input().split()]
a.sort()
d={}
for i in a:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
p=max(a)*2
chk=[pow(2,i) for i in range(1,32) if pow(2,i)<=p]
ans=0
for i in a[::-1]:
    if d[i]>0:
        d[i]-=1
        for j in chk[::-1]:
            if j-i in d and d[j-i]>0:
                d[j-i]-=1
                ans+=1
                break
print(ans)
if x==0:
   print (1)
elif x==1:
   print(0)

### FIXED CODE ###

x=int(input())

if x==0:
  print(1)
elif x==1:
  print(0)
# -*- coding: utf-8 -*-
import sys


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


def main():

    N = int(input())
    DATA = [list(map(int, input().split())) for i in range(N)]

    dp = [[0 for _ in range(3)] for _ in range(N + 1)]

    for i in range(N):
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + DATA[i][k])

    res = 0

    for v in range(3):
        res = max(res, dp[N][v])

    print(res)


if __name__ == '__main__':
    N = int(input())
    A = [int(x) for x in input().split()]
    main(N, A)


### FIXED CODE ###

import sys

input = sys.stdin.readline

vacation = int(input())
lst_happiness = [list(map(int, input().split())) for i in range(vacation)]

dp = [[0 for i in range(3)] for j in range(vacation+1)]
def chmax(a, b):
    if a > b:
        return a
    else:
        return b

for i in range(vacation):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = chmax(dp[i+1][k], dp[i][j] + lst_happiness[i][k])
ans = 0
for i in range(3):
    ans = chmax(ans, dp[vacation][i])
print(ans)
import math

nums = map(int,input().split())

ans=0
for n in nums:
    ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
print(ans)

### FIXED CODE ###

import math

nums = map(int,input().split())

ans=0
for n in nums:
    if n<2:
    	continue
    ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
print(ans)
import sys
sys.setrecursionlimit(10000)

def rec(i, j):
    flag = False
    flag_ = False
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - i)
    if tmp > dp[i+1][j]:
        dp[i+1][j] = tmp
        flag = True
    tmp_ = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - N + j + 1)
    if tmp_ > dp[i][j+1]:
        dp[i][j+1] = tmp_ if tmp_ > dp[i][j+1] else dp[i][j+1]
        flag_ = True
    if i + j == N - 1:
        return
    if flag:
        rec(i + 1, j)
    if flag_:
        rec(i, j + 1)
    
N = int(input())
A = sorted([(int(j),i) for i, j in enumerate(input().split())])[::-1]

dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
rec(0, 0)
ans = -1
for i in range(N):
    for j in range(N):
        if dp[i][j] > ans:
            ans = dp[i][j]
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
B = [0]*N
for i in A:
    B[i-1] += 1
for i in B:
    print(i)
def solve(a, b, c, d):
    op_list = ['+', '-']
    sumv = a
    for op1 in op_list:
        if op1 == '+':
            sumv += b
        else:
            sumv -= b
        for op2 in op_list:
            if op2 == '+':
                sumv += c
            else:
                sumv -= c
            for op3 in op_list:
                if op3 == '+':
                    sumv += d
                else:
                    sumv -= d
                if sumv == 7:
                    return op1, op2, op3
                sumv = a


def main():
    tmp = input()
    a, b, c, d = int(tmp[0]), int(tmp[1]), int(tmp[2]), int(tmp[3])
    op_list = ['+', '-']

    op1, op2, op3 = solve(a, b, c, d)
    print(str(a) + op1 + str(b) + op2 + str(c) + op3 + str(d) + '=7')
                    

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    num = input()
    a, b, c, d = [int(i) for i in num]
    num_list = [a, b, c, d]
    if (a-b-c-d == 7): print('{}-{}-{}-{}=7'.format(*num_list))
    elif (a-b-c+d == 7): print('{}-{}-{}+{}=7'.format(*num_list))
    elif (a-b+c-d == 7): print('{}-{}+{}-{}=7'.format(*num_list))
    elif (a+b-c-d == 7): print('{}+{}-{}-{}=7'.format(*num_list))
    elif (a-b+c+d == 7): print('{}-{}+{}+{}=7'.format(*num_list))
    elif (a+b+c-d == 7): print('{}+{}+{}-{}=7'.format(*num_list))
    elif (a+b-c+d == 7): print('{}+{}-{}+{}=7'.format(*num_list))
    elif (a+b+c+d == 7): print('{}+{}+{}+{}=7'.format(*num_list))
                    

if __name__ == '__main__':
    main()
def mult(m):
  s = 1
  for x in m:
    s = s * x
    if s == 0:
      return 0
    if s > 10**18:
      return -1
   return s
n = int(input())
a = list(map(int,input().split()))
a.sort()
z = mult(m)
print(z)

### FIXED CODE ###

def mul(m) : 
      
    # Multiply elements one by one 
    res = 1
    for x in m: 
        res = res * x
        if res == 0:
             return 0 
        if res > 10**18:
             return -1
    return res
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
z = mul(a)
print(z)
import itertools
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split())) for _ in range(q)]
l=list(range(1,m+1))
l=list(itertools.combinations_with_replacement(l,m))
ans=0
for i in l:
  kari=0
  for j in range(q):
    if i[abcd[j][1]-1]-i[abcd[j][0]-1]==abcd[j][2]:
      kari+=abcd[j][3]
  ans=max(ans,kari)
print(ans)

### FIXED CODE ###

import itertools
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split())) for _ in range(q)]
l=list(range(1,m+1))
l=list(itertools.combinations_with_replacement(l,n))
ans=0
for i in l:
  kari=0
  for j in range(q):
    if i[abcd[j][1]-1]-i[abcd[j][0]-1]==abcd[j][2]:
      kari+=abcd[j][3]
  ans=max(ans,kari)
print(ans)
s = raw_input()
N = int(raw_input())
dis = [ord('z')-ord(c) for c in s]
for idx, d in enumerate(dis[:-1]):
    if d <= N:
        s[idx] = 'a'
        N -= d
if N > 0:
    N %= 27
    t = (dis[-1]-N) % 27
    s[-1] = chr(ord('z') - t)
print s

### FIXED CODE ###

txt = raw_input()
print txt[:4], txt[4:]
N,D=map(int,input().split())
ans =0

for i in range(N):
X,Y =map(int,input().split())
if D::2>=X**2+y**2:
    ans +=1

print(ans)

### FIXED CODE ###

N,D=map(int,input().split())
ans =0

for i in range(N):
    X,Y =map(int,input().split())
    if D**2>=X**2+Y**2:
        ans +=1

print(ans)
A, B = map(int, input().split())

print(["error", A + B] [A + B < 10])


### FIXED CODE ###

r, g, b = map(int, input().split())

if (r * 100 + g * 10 + b) % 4 == 0:
    print("YES")
else:
    print("NO")
n = input()

print(n.replace("1","9").replace("9","1")
      


### FIXED CODE ###

n = input()

print(n.replace("1","x").replace("9","1").replace("x","9"))