Harryxun/stf_run huggingface dataset:
import numpy as np
N,M,Q = map(int,input().split())
vote = np.array([[0 for _ in range(N)] for _ in range(N)])
for i in range(M):
    l,r = map(int,input().split())
    vote[:l,r-1:] += 1
for i in range(Q):
    p,q = map(int,input().split())
    print(vote[p-1][q-1])

### FIXED CODE ###

N,M,Q = map(int,input().split())
vote = [[0 for _ in range(N+1)] for _ in range(N+1)]
cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
    l,r = map(int,input().split())
    vote[l][r] += 1
for i in range(1,N+1):
    for j in range(1,N+1):
        cum[i][j] = vote[i][j]+cum[i-1][j]+cum[i][j-1]-cum[i-1][j-1]
for i in range(Q):
    p,q = map(int,input().split())
    print(cum[q][q]-cum[q][p-1]-cum[p-1][q]+cum[p-1][p-1])
import sys
while 1:
    h,w = sys.stdin.readline().split()
    if h == w == 0:break
    print('#'*w)
    print(('#'+'.'*(w-2)+'#\n')*(h-2),end ='')
    print('#'*w)

### FIXED CODE ###

while True:
    h,w = map(int,input().split())
    if h == w == 0:break
    print('#'*w)
    print(('#' + '.'*(w-2) + '#\n')*(h-2),end = '')
    print('#'*w + '\n')
s = int(input())

# (0,0),(0,x),(x,y)
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)
    divisors.sort()
    return divisors

yakusu = make_divisors(s)[1]


print(0,0,int(s/yakusu),0,0,int(yakusu))


### FIXED CODE ###

S = int(input())
X1, Y1, X2, Y2 = 0, 0, 10**9, 1
shou, amari = divmod(S, 10**9)
 
if amari == 0:
    Y3 = shou
    X3 = 0
else:
    Y3 = shou + 1
    X3 = -(amari - 10**9)
 
print(X1, Y1, X2, Y2, X3, Y3)
a=input().strip().split(" ")
b=[int(i) for in a]

if(b[0]<=8 and b[1]<=8):
    print("Yay!")
else:
    print(":(")


### FIXED CODE ###

a=input().strip().split(" ")
b=[int(i) for i in a]

if(b[0]<=8 and b[1]<=8):
    print("Yay!")
else:
    print(":(")
word=input()
how_in=0
while True:
    try:
        statement=input()
    except:
        break
    if statement=='END_OF_TEXT':
        break
    statement=statement.lower()
    statement.remove(' ')
    if word in statement :
        how_in+=statement.count(word)

print(how_in)

### FIXED CODE ###

word=input().lower()
how_in=0
while True:
    letters=input()
    if letters=='END_OF_TEXT':
        break
    for i in letters.lower().split():
        if i==word:
            how_in+=1
print(how_in)
N = int(input())
X = input()
M = {X[0:3]:1}
result = {}

for i in range(3,N):
    i = X[i]
    keys = M.keys()
    for j in tuple(keys):
        if (j, i) in result:
            continue
        M[j[0]+j[1]+i] = 1
        M[j[0]+j[2]+i] = 1
        M[j[1]+j[2]+i] = 1
        result[(j,i)] = True
	if len(M) == 729:
      break
print (len(M))

### FIXED CODE ###

N = int(input())
X = input()
#X = "196341362415710923461093419237419237417234162348162390471092374190237410982374901"*300
#N = len(X)
M = { }
A = set()
A.add(X[0]+X[1])
for i in range(2, N) :
    i = X[i]
    for j in tuple(A):
        M[j + i] = 1
        A.add(j[0]+i)
        A.add(j[1]+i)

    if len(M) == 1000:
        break
print(len(M))
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i,j in enumerate(a):
  if j >= 0:
    if i % 2 == 0:
      ans = abs(sum(a[:i]))+sum(a[i:])
      break
    else:
      ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
      break
print(ans)


### FIXED CODE ###

import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i-1]))+a[i-1]
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)
import numpy as np

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

mat = np.zeros((n, n), dtype=int)

for _ in range(m):
    l, r = map(int, input().split())
    mat[l-1][r-1] += 1

ans = np.cumsum(mat, axis=1)[::-1], axis=0)[::-1]

for _ in range(q):
    l, r = map(int, input().split())
    print(ans[l-1][r-1])


### FIXED CODE ###

import numpy as np

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

mat = np.zeros((n, n), dtype=int)

for _ in range(m):
    l, r = map(int, input().split())
    mat[l-1][r-1] += 1

ans = np.cumsum(np.cumsum(mat, axis=1)[::-1], axis=0)[::-1]

for _ in range(q):
    l, r = map(int, input().split())
    print(ans[l-1][r-1])
def main():
    n = int(input())
    s = [int(i) for i in input().split()]

    if "Y" in s:
        print("Four")
    else:
        print("Three")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = input().split()

    if "Y" in s:
        print("Four")
    else:
        print("Three")


if __name__ == '__main__':
    main()
n = int(input())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    tree[u-1].append((v-1, w))
    tree[v-1].append((u-1, w))

visited = [False for _ in range(n)]
visited[0] = True
ans = [0 for _ in range(n)]

def journey(next, bit):
    for pos in next:
        v, w = pos
        if visited[v]: continue
        visited[v] = True
        #print(pos, bit, bit+w)
        if (bit+w) % 2 == 0: ans[v] = 0
        else: ans[v] = 1
            
        journey(tree[v], bit+w)
    
journey(tree[0], 0)
[print(x) for x in ans]

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

n = int(input())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    tree[u].append((v, w))
    tree[v].append((u, w))

ans = [0 for _ in range(n)]

def journey(u, p, bit):
    ans[u] = bit
    for v, w in tree[u]:
        if v == p: continue
        if w % 2 == 0: journey(v, u, bit)
        else: journey(v, u, 1-bit)
    
journey(0, -1, 0)
[print(x) for x in ans]
while True:
 x,y=sorted [int(x) for x in input().split()]
 if (x,y)==(0,0):
  break
 print(x,y)

### FIXED CODE ###

while True:
 x,y=sorted ([int(x) for x in input().split()])
 if (x,y)==(0,0):
  break
 print(x,y)
import math
a, b = map(int, input().split())

l = a * b / math.gcd(a, b)
l = int(l)
print("{}".format(l))

### FIXED CODE ###

def gcd(A,B):
    if(A<B):
        tmp=A
        A=B
        B=tmp

    r=A%B

    while(r!=0):
        A=B
        B=r
        r=A%B
        
    return B


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

l = a * b /gcd(a, b)
l = int(l)
print("{}".format(l))
target = input()
data = ""
while True:
    tmp = input()
    if(tmp == "END_OF_FILE"): break
    data += tmp

print("%d" %(data.lower().count(target.lower())))


### FIXED CODE ###

import sys
target = input()
data = sys.stdin.read()

print("%d" %(data.lower().split().count(target.lower())))
n = int(input())
l = list(input().split())
for i in range(n):
  print(l[0][n] + l[1][n])

### FIXED CODE ###

n = int(input())
l = list(input().split())
s = ""
for i in range(n):
  s += (l[0][i] + l[1][i])
print(s)
x = input()
print(3.141592653589793 * x**2, 3.141592653589793 * 2* x)


### FIXED CODE ###

#x = [int(i) for i in input().split()]
x = float(input())
print(3.141592653589793 * x**2, 3.141592653589793 * 2* x)
N=int(input())
A=list(map(int,input().split()))
a=[1/A for i in A]
x=sum(a)
print(float(1/x))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
a=[1/float(num) for num in A]
x=sum(a)
print(1/float(x))
S=input()
key="keyence"

exclude=0
now=False
count=0
for i in range(len(S)):
    s=S[i]
    if s==key[count] and count<7:
        if now:
            now=False
        count+=1
    else:
        if (not now) and exclude>0:
            print("NO")
            exit()
        if not now:
            exclude+=1
            now=True
if count!=7:
    print("NO")
else:
    print("YES")
#print(count)

### FIXED CODE ###

S=input()
key="keyence"

if S.find(key)!=-1:
    print("YES")
    exit()


count=0
for i in range(7):
    s=S[i]
    if s==key[count]:
        count+=1
    else:
        break

for i in range(-1,-8,-1):
    s=S[i]
    if s==key[i]:
        count+=1
    else:
        break
if count>=7:
    print("YES")
else:
    print("NO")
a,b,c,d=map(int,input().split())
print(-a+b-c+d+2)

### FIXED CODE ###

print(("Yes","No")[len(set(input()[::2]))-1])
n,k,m=(int(x) for x in input().split())
a=[int(x) for x in input().split()]

sum = 0
for ai in a:
    sum+= ai

t = m * n  - sum
if t <= 0:
    print(0)
elif t<= k:
    print(t)
else:
    print(-1)





### FIXED CODE ###

b = bytearray(input().encode())[0] + 0x01
print(b.to_bytes(1, 'big' ).decode())
A, B, C, X, Y = map(int, input().split())

ans = float("inf")

if X > Y:
    ab = 2 * X
    while ab > 0:
        a = X - (ab / 2)
        if ab / 2 < Y:
            b = int(Y - 2 * ab)
        else:
            b == 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
else:
    ab = 2 * Y
    while ab > 0:
        b = Y - (ab / 2)
        if ab / 2 < X:
            a = int(X - 2 * ab)
        else:
            a = 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
print(int(ans))


### FIXED CODE ###

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

ans = float("inf")

if X > Y:
    ab = 2 * X
    while ab >= 0:
        a = X - (ab / 2)
        if ab / 2 < Y:
            b = int(Y - ab / 2)
        else:
            b = 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
else:
    ab = 2 * Y
    while ab >= 0:
        b = Y - (ab / 2)
        if ab / 2 < X:
            a = int(X - ab / 2)
        else:
            a = 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
print(int(ans))
N, X = map(int, input().split())
x = list(map(int,input().split()))
D = abs(x[0]-X)
for i in x:
    D = math.gcd(D,abs(i-X))
print(D)

### FIXED CODE ###

c, d = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]
b = a.copy()
 
k = 0
for i in a:
    b[k] = abs(i - d)
    k += 1
 
m = min(b) 
 
def dec():
 
    i = m
    while i > 0:
        if m% i == 0: 
            k = 0
            for j in b:
                if j%i ==0:
                    k +=1
                if k==len(b):
                    return i
                
            if i == m:
                i -= i//2
                
        i -=1
 
 
 
 
                
print(dec())
n = int(input())

seq = list(map(int,input().split()))

unique = []

seq = sorted(seq)
c = 0
k = seq[0]

for i in seq:
    if not i in unique:
        unique.append(i)

unique_n = [0]*len(unique)

for i in seq:
    if i == k:
        unique_n[c] += 1
    
    else:
        c += 1
        unique_n[c] += 1





if n == 1:
    print(1)

elif n == 2:
    if max(seq) - min(seq) <= 2:
        print(2)
    
    else:
        print(1)

else:
    max_n = 0
    
    for i in range(1,len(unique)-2):
        cnt = 0
        cnt += unique_n[i-1]
        cnt += unique_n[i]
        cnt += unique_n[i+1]
    
        if cnt > max_n:
            max_n = cnt

    
    print(max_n)


### FIXED CODE ###

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

ans = [0 for i in range(2*10**5+2)]

for i in a:
    ans[i-1] += 1
    ans[i] += 1
    ans[i+1] += 1
    
print(max(ans))
import sys

x = sys.stdin.readline()
print(x**3)

### FIXED CODE ###

import sys

x = sys.stdin.readline()
print(int(x)**3)
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)[::-1]
memo = [0 for i in range(N)]
memo[0] = N-1
memo[1] = N-1
if N % 2 == 0:
    for i in range(2, N):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()
else:
    for i in range(2, N-1):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()



print((2**(N // 2))%(10**9+7))

### FIXED CODE ###

N = int(input())
if N == 1:
    print(1)
    exit()
A = list(map(int, input().split()))
A = sorted(A)[::-1]
memo = [0 for i in range(N)]
memo[0] = N-1
memo[1] = N-1
if N % 2 == 0:
    for i in range(2, N):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()
else:
    for i in range(2, N-1):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()


# 最初(N//2)**2にしていた、それぞれの場合の数ではなくなってしまう
print((2**(N // 2))%(10**9+7))
N = input()
test = list(map(int,input().split()))
M = input() 
  
for _ in range(M):
  a,b = int(input()).split()
  test[a] = b
  print(sum(test))

### FIXED CODE ###

N = int(input())
test = list(map(int,input().split()))
M = int(input()) 
  
for _ in range(M):
  a,b = map(int,input().split())
  print(sum(test) - test[a-1] + b)
N = int(input())
L = [list(map(int, input().split())) for i in range(N-1)]

A = [0] * (N)
L.sort()
for i in L:
    if i[2]%2 != 0 and L[i[0]] == L[i[1]]:
        L[i[0]] = !L[i[0]]
    elif i[2]%2 == 0:
        L[i[1]] = L[i[0]]
for i in A:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N = int(input())
W = [list(map(int, input().split())) for _ in range(N-1)]
nodes = [[] for _ in range(N+1)]
for w in W:
    nodes[w[0]].append((w[1], w[2]))
    nodes[w[1]].append((w[0], w[2]))
ans = [-1] * (N+1)
ans[1] = 0
def search(num, root, dis):
    for node in nodes[num]:
        sum_d = dis
        if node[0] != root:
            idx = node[0]
            sum_d += node[1]%2
            if sum_d%2 != 0:
                ans[idx] = 1
            else:
                ans[idx] = 0
            search(idx, num, sum_d)

search(1, 0, 0)
for answer in ans[1:]:
    print(answer)
import sys
from operator import itemgetter


def main():
    input = sys.stdin.readline
    N, T = map(int, input().strip().split())
    foods = sorted([(map(int, input().strip().split())) for _ in range(N)], key=itemgetter(0))

    ans = 0
    dp = [[0] * (T+1) for _ in range(N+1)]
    for j, food in enumerate(foods):
        n_a, n_b = food
        for k in range(T+1):
            if k == T:
                dp[j+1][k] = max(dp[j][k], dp[j][k-1]+n_b)
            elif k < n_a:
                dp[j+1][k] = dp[j][k]
            else:
                dp[j+1][k] = max(dp[j][k], dp[j][k-n_a]+n_b)
        #print(dp[j+1])
    ans = dp[-1][-1]
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from operator import itemgetter


def main():
    input = sys.stdin.readline
    N, T = map(int, input().strip().split())
    foods = sorted([list(map(int, input().strip().split())) for _ in range(N)], key=itemgetter(0))

    ans = 0
    dp = [[0] * (T+1) for _ in range(N+1)]
    for j, food in enumerate(foods):
        n_a, n_b = food
        for k in range(T+1):
            if k == T:
                dp[j+1][k] = max(dp[j][k], dp[j][k-1]+n_b)
            elif k < n_a:
                dp[j+1][k] = dp[j][k]
            else:
                dp[j+1][k] = max(dp[j][k], dp[j][k-n_a]+n_b)
        #print(dp[j+1])
    ans = dp[-1][-1]
    print(ans)

if __name__ == "__main__":
    main()
n = int(input())
ans = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
for i in range(n):
    if i == 0:
        string = input()
        for j in string:
            ans[j] += 1
    else:
        tmp = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
        string = input()
        for j in string:
            tmp[j] += 1
            
        for j in tmp:
            ans[j] = min(ans[j],tmp[j])

anser = ''
for i in ans:
    for j in range(ans[i]):
        anser += i
print(anser.sort())

### FIXED CODE ###

import string
n = int(input())
ans = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
for i in range(n):
    if i == 0:
        st = input()
        for j in st:
            ans[j] += 1
    else:
        tmp = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
        st = input()
        for j in st:
            tmp[j] += 1
            
        for j in tmp:
            ans[j] = min(ans[j],tmp[j])

anser = ''
for d in string.ascii_lowercase:
    for j in range(ans[d]):
        anser += d
print(anser)
answer = C-(A-B)
  if answer<0:
    answer=0
  print(int(answer))

### FIXED CODE ###

A,B,C=(int(x) for x in input().split())
answer = C-(A-B)
if answer<0:
  answer=0
print(int(answer))
As = input().split()
print(max(As)-min(As))

### FIXED CODE ###

As = input().split()
result =  int(max(As)) - int(min(As))
print(-result if result<0 else result)
n,a, b = map(int, input().split())
    ans = n //(a+b) *a
    tmp = n%(a+b)
    ans += min(tmp,a)
    print(ans)

### FIXED CODE ###

n,a, b = map(int, input().split())
ans = n //(a+b) *a
tmp = n%(a+b)
ans += min(tmp,a)
print(ans)
def gcd(a, b):
    while a > 0:
        a = a % b
        a, b = b, a
    return b

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

res = abs(town[0] - x)
for t in town[1:]:
    d = abs(t - x)
    res = gcd(res, d)

print(res)

### FIXED CODE ###

from fractions import gcd
from functools import reduce

n, x = map(int, input().split())
town = map(int, input().split())

dist = map(lambda y: abs(x - y), town)
res = reduce(gcd, dist)
print(res)
N,K = input().split()
H = input().split()

if N < K:
    times = N
else:
    times = K

for i in range(int(times)):
    H.remove(max(H))

print(sum(H))

### FIXED CODE ###

enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = list(map(int,input().split()))

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += enemyHp[i]
    print(countNormal)
import math

A, B, C, D = map(int, input().split())
E = (C * D) // math.gcd(C, D)
num_c = B // C - A // C + (1 if A % C == 0 else 0)
num_d = B // D - A // D + (1 if A % D == 0 else 0)
num_e = B // E - A // E + (1 if A % E == 0 else 0)
num = B - A + 1 - (num_c + num_d - num_e)
print(num)

### FIXED CODE ###

import fractions

A, B, C, D = map(int, input().split())
E = (C * D) // fractions.gcd(C, D)
num_c = B // C - A // C + (1 if A % C == 0 else 0)
num_d = B // D - A // D + (1 if A % D == 0 else 0)
num_e = B // E - A // E + (1 if A % E == 0 else 0)
num = B - A + 1 - (num_c + num_d - num_e)
print(num)
N = int(input())
if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 188
    print(3)
elif N < 195:
    print(4)
else:
    print(5)

### FIXED CODE ###

N = int(input())
if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)
n=int(input())
s=list(map(ord,input().split()))
R=[0]
G=[0]
B=[0]
for i in s:
  R.append(R[-1])
  G.append(G[-1])
  B.append(B[-1])
  if i==82:R[-1]+=1
  elif i==71:G[-1]+=1
  else:B[-1]+=1
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    if s[i]==s[j]:continue
    if 82 not in [s[i],s[j]]:
      ans+=R[-1]-R[j]
      if j+(j-i)<n:
        if s[j+(j-i)]==82:ans-=1
    elif 71 not in [s[i],s[j]]:
      ans+=G[-1]-G[j]
      if j+(j-i)<n:
        if s[j+(j-i)]==71:ans-=1
    else:
      ans+=B[-1]-B[j]
      if j+(j-i)<n:
        if s[j+(j-i)]==66:ans-=1
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
R=[0]
G=[0]
B=[0]
for i in s:
  R.append(R[-1])
  G.append(G[-1])
  B.append(B[-1])
  if i=="R":R[-1]+=1
  elif i=="G":G[-1]+=1
  else:B[-1]+=1
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    if s[i]==s[j]:continue
    if "R" not in [s[i],s[j]]:
      ans+=R[-1]-R[j]
      if j+(j-i)<n:
        if s[j+(j-i)]=="R":ans-=1
    if "G" not in [s[i],s[j]]:
      ans+=G[-1]-G[j]
      if j+(j-i)<n:
        if s[j+(j-i)]=="G":ans-=1
    if "B" not in [s[i],s[j]]:
      ans+=B[-1]-B[j]
      if j+(j-i)<n:
        if s[j+(j-i)]=="B":ans-=1
print(ans)
s=list(input())
n=len(s)
for i in range(2**(n-1)):
	ni=list(map(int,list(str(format(i,"b")))))
	while len(ni)<n-1:
		ni.insert(0,0)
	siki=s[0]
	for j in range(n-1):
		if ni[j]==1:
			siki+="+"
		siki+=s[j+1]
	ans+=eval(siki)
print(ans)

	

### FIXED CODE ###

s=list(input())
n=len(s)
ans=0
for i in range(2**(n-1)):
	ni=list(map(int,list(str(format(i,"b")))))
	while len(ni)<n-1:
		ni.insert(0,0)
	siki=s[0]
	for j in range(n-1):
		if ni[j]==1:
			siki+="+"
		siki+=s[j+1]
	ans+=eval(siki)
print(ans)
li = list(map(int, input().split()))
li.sort(*, key = None, reverse = True)
i = 0
while i <= len(li): 
    a = li[i]
    i += 2
i = 1
while i <= len(li):
    b = li[i]
    i += 2
print(a -b)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort(reverse = True)
i = 0
a = 0
b = 0
while i < n: 
    a = a +l[i]
    i += 2
i = 1
while i < n:
    b = b +l[i]
    i += 2
print(a -b)
import sys
while True:
  x,y = sys.stdin.readline().split()
  if x == 0 and y == 0:
    break

  if x > y:
    print(y,x)
  print(x,y)

### FIXED CODE ###

import sys
while True:
    a,b=map(int,sys.stdin.readline().split())
    if a==0 and b==0:
        break
    if a<b:print(a,b)
    else:print(b,a)
#!/usr/bin/env python3

def reachable(start, target, lst, S):

    dp0 = [False for i in range(S)]
    dp1 = [False for i in range(S)]

    dp1[target] = True

    for moves in lst[::-1]:
        for i in range(S):
            dp0[i] = False
        for i in range(S):
            if dp1[i]:
                dp0[i + moves] = True
                dp0[i - moves] = True
        dp0, dp1 = dp1, dp0

    return dp1[start]

def main():
    s = input()
    sa = input().split(' ')
    x = int(sa[0])
    y = int(sa[1])

    x_list = []
    y_list = []
    moves = 0
    move_x = True
    lst = x_list
    for cmd in s:
        if cmd == 'F':
            moves += 1
        else:
            if moves != 0:
                lst.append(moves)
            moves = 0
            move_x = not move_x
            lst = x_list if move_x else y_list
    if moves != 0:
        lst.append(moves)

    if 0 < len(x_list):
        x -= x_list[0]
        x_list = x_list[1:]

    len_s = len(s)
    if reachable(len_s, len_s + x, x_list, len_s * 2) and reachable(len_s, len_s + y, y_list, len_s * 2):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3


def reachable(start, target, lst):

    current = set()
    current.add(start)

    for moves in lst:
        candidates = set()
        for x in current:
            candidates.add(x + moves)
            candidates.add(x - moves)
        current = candidates

    return target in current


def main():
    s = input()
    sa = input().split(' ')
    x = int(sa[0])
    y = int(sa[1])

    x_list = []
    y_list = []
    moves = 0
    move_x = True
    lst = x_list
    for cmd in s:
        if cmd == 'F':
            moves += 1
        else:
            # cmd == 'T'
            if moves != 0:
                lst.append(moves)
            moves = 0
            move_x = not move_x
            lst = x_list if move_x else y_list
    if moves != 0:
        lst.append(moves)

    if s[0] == 'F':
        x -= x_list[0]
        x_list = x_list[1:]

    if reachable(0, x, x_list) and reachable(0, y, y_list):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
a,b,c,d = input().split()
pm = '+-'
for i in pm:
  for j in pm:
    for k in pm:
      total = a+i+b+j+c+k+d
      if eval(total) == 7:
        print(total+'=7')
        exit()

### FIXED CODE ###

A = input()
n = len(A)-1
for i in range(2**n):
  pn = ['-']*n
  for j in range(n):
    if ((i>>j)&1):
      pn[n-1-j] = '+'
  ans = A[0]+pn[0]+A[1]+pn[1]+A[2]+pn[2]+A[3]
  
  if eval(ans) == 7:
    print(ans+'=7')
    break