Harryxun/stf_run huggingface dataset:
import numpy as np
import sys
from collections import defaultdict


def first_prime_list(N):
    D = [1] * (N + 1)

    for i in range(2, N + 1):
        if D[i] != 1:
            continue
        for j in range(1, N // i + 1):
            if D[i * j] == 1:
                D[i * j] = i

    return D


def factorization_with_fpl(A, D):

    Ps = defaultdict(int)
    current_p = D[A]

    while D[A] > 1:
        cnt = 0
        while D[A] == current_p:
            A = A // D[A]
            cnt += 1

        Ps[current_p] = cnt
        current_p = D[A]

    if A != 1:
        Ps[A] = 1

    return Ps


N = int(sys.stdin.readline().rstrip())
A = [int(x) for x in sys.stdin.readline().rstrip().split()]

D = first_prime_list(max(A))

pc = True
sp = True

maxlist = factorization_with_fpl(A[0], D)
minlist = factorization_with_fpl(A[0], D)

arrA = np.array(A)

for i in range(1, N):
    d = factorization_with_fpl(A[i], D)
    for p in maxlist.keys():
        if min(maxlist[p], d[p]) != 0:
            pc = False
        maxlist[p] = max(maxlist[p], d[p])
        minlist[p] = min(minlist[p], d[p])


for p in minlist.keys():
    if minlist[p] != 0:
        sp = False


if pc:
    print("pairwise coprime")
elif sp:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

import sys
import math


N_MAX = 200000 + 5
INF = 10**9 + 7
sys.setrecursionlimit(N_MAX)
MOD = 10**9 + 7


def main():
    N = int(sys.stdin.readline().rstrip())
    A = [int(x) for x in sys.stdin.readline().rstrip().split()]

    maxA = max(A)

    # 1 <= a <= maxA までの、要素の登場回数
    C = [0] * (maxA + 1)
    for a in A:
        C[a] += 1

    pc = True

    # p の倍数である個数をカウントする
    for p in range(2, maxA + 1):
        cnt = 0
        for k in range(maxA // p + 1):
            cnt += C[k * p]

        # k*p となるような要素が2個以上あったら、pairwise coprime ではない
        if cnt > 1:
            pc = False

    if pc:
        print("pairwise coprime")
        return

    GCD = A[0]
    for i in range(1, N):
        GCD = math.gcd(GCD, A[i])

    if GCD == 1:
        print("setwise coprime")
        return

    print("not coprime")


main()
A,B,C = map(int,input().split())
if A == B:
  print(C)
 elif B == C:
  print(A)
 else:
  print(B)

### FIXED CODE ###

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

if A == B:
 	print(C)
elif B == C:
 	print(A)
else:
    print(B)
n = int(input())
h = list(map(int,input().split()))
c = 0
a = []
for i in range(n-1):
  if h[i]>=h[i+1]:
    c += 1
  else:
    a.append(c)
    c =0
  print(c)
print(max(a))

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
c = 0
a = [0]
for i in range(n-1):
  if h[i]>=h[i+1]:
    c += 1
  else:
    a.append(c)
    c =0
  a.append(c)
print(max(a))
S = input()
S = int(S)
g=input()
f = list(g)
if len(f) == S:
  h =set(f)
  k = list(h)
  if len(h)==1:
    print('No')
  else :
    print('Yes')
else:
  pass

### FIXED CODE ###

g=input()
f = list(g)
h =set(f)
k = list(h)
if len(h)==1:
  print('No')
else :  
  print('Yes')
print('Yes' if len(set(input()))==2 and S.count(S[0])==2 else 'No')

### FIXED CODE ###

print('Yes' if len(set(input()))==2 else 'No')
a, b = map(int, input().split())

buf = a - b

if buf % 2 = 0:
	print(buf // 2)
else:
	print("IMPOSSIBLE")

### FIXED CODE ###

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

buf = a + b

if buf % 2 == 0:
	print(buf // 2)
else:
	print("IMPOSSIBLE")
# coding: utf-8
# Your code here!
from collections import deque
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]

if m%2: print(-1); exit()

L = [0]*n

g = [set() for _ in range(n)]
for i in range(m):
    a,b = [int(i) for i in readline().split()]
    g[a-1].add(b-1)
    g[b-1].add(a-1)
    L[a-1] += 1
    L[b-1] += 1


used = [0]*m
def dfs(v):
    res = 0
    for c in g[v]:
#        if used[i] == 1: continue
        g[v-1].remove(c-1)
        g[c-1].remove(v-1)
        p =  dfs(c)
        if p%2 == 1:
            print(v+1,c+1)
        else:    
            print(c+1,v+1)
        res += p
    return res+1


for i in range(n):
    dfs(i)
#print(q)












### FIXED CODE ###

# coding: utf-8
# Your code here!
from collections import deque
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]

if m%2: print(-1); exit()

#L = [0]*n

g = [[] for _ in range(n)]
for i in range(m):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append((b-1,i))
    g[b-1].append((a-1,i))
#    L[a-1] += 1
#    L[b-1] += 1



used = [0]*m
usedp = [0]*n
def dfs(v):
    res = 0
    for (c,i) in g[v]:
        if used[i] == 1: continue
        used[i] = 1
        if usedp[c] == 1:
            res += 1
            print(v+1,c+1)
            continue
        usedp[c] = 1
        p =  dfs(c)
        if p%2 == 1:
            print(v+1,c+1)
        else:    
            print(c+1,v+1)
        res += p
    return res+1


for i in range(n):
    dfs(i)
#print(q)
from collections import defaultdict
n,m= map(int, input().split())
a = list(map(int, input().split()))
d = []
for i in range(m):
    b,c = map(int, input().split())
    d.append([b,c])
d = sorted(d, key=lambda x:x[1], reverse=True)
a = sorted(a)
itr = 0
for i in range(len(d)):
    change = d[i]

    for j in range(change[0]):
        if a[itr] > change[1]:
            print(sum(a))
            exit()
        else:
            a[itr] = change[1]
        itr+=1
        if itr == n:
            break
print(sum(a))


### FIXED CODE ###

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

bc = []

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

bc = sorted(bc, key=lambda x: x[1],reverse=True)
a = sorted(a)

itr = 0 
for i in bc:
    b, c = i[0], i[1]
    for j in range(b):
        if a[itr]>=c:
            print(sum(a))
            exit()
        else:
            a[itr]=c
            itr +=1
            if itr == n:
                print(sum(a))
                exit()
print(sum(a))
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (b - a == c - b) {
    cout << "YES" << endl;
    return 0;
  } else {
    cout << "NO" << endl;
    return 0;
  }
}


### FIXED CODE ###

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

if b - a == c - b:
  print("YES")
else:
  print("NO")
S = int(input())
h = int(S / 60) / 60
m = int(S / 60) % 60
s = int(S % 60)

print"{0}:{1}:{2}",format(h,m,s)

### FIXED CODE ###

S = int(input()) 
h = int((S / 60) / 60) % 60
m = int(S / 60) % 60
s = int(S % 60)

print("{0}:{1}:{2}".format(h,m,s))
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
TF=[True for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    TF[B-1]=False
  elif H[A-1]<H[B-1]:
    TF[A-1]=False:
  else:
    TF[A-1]=False
    TF[B-1]=False
ans=0
for i in range(N):
  if TF[i]==True:
    ans+=1
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
TF=[True for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    TF[B-1]=False
  elif H[A-1]<H[B-1]:
    TF[A-1]=False
  else:
    TF[A-1]=False
    TF[B-1]=False
ans=0
for i in range(N):
  if TF[i]==True:
    ans+=1
print(ans)
s,ans=input(),0;a=[s[i]for i in range(len(s))];a.sort()
for i in a:
  if a.count(i)%2!=0:ans=1
if ans=0:print("Yes")
else:print("No")

### FIXED CODE ###

s,ans=input(),0;a=[s[i]for i in range(len(s))];a.sort()
for i in a:
  if a.count(i)%2!=0:ans=1
if ans==0:print("Yes")
else:print("No")
def SUNUKE(i):
    x=str(i)
    SUM=0

    for j in range(len(x)):
        SUM+=int(x[j])

    return SUM,i/SUM

SUNUKESUU=[0,1,2,3,4,5,6,7,8,9]
i=10
keta=0

while i<10**5:


    if SUNUKE(i)[1]>=10**keta:
        i-=10**keta
        keta+=1
        
    else:
        if SUNUKESUU[-1]!=i:
            SUNUKESUU+=[i]
        i+=10**keta
    

for i in range(1,int(input())+1):
    print(SUNUKESUU[i])


### FIXED CODE ###

def SUNUKE(i):
    x=str(i)
    SUM=0

    for j in range(len(x)):
        SUM+=int(x[j])

    return SUM,i/SUM

SUNUKESUU=[0,1,2,3,4,5,6,7,8,9]
i=10
keta=0

while i<10**16:


    if SUNUKE(i)[1]>=10**keta:
        i-=10**keta
        keta+=1
        
    else:
        if SUNUKESUU[-1]!=i:
            SUNUKESUU+=[i]
        i+=10**keta
    

for i in range(1,int(input())+1):
    print(SUNUKESUU[i])
T=str(input())
cnt=0
cc=[]
count=len(T)
for i in T:
    if i=='P':
        cnt=1
        cc.append('P')

    elif i=='D':
        cnt=0
        cc.append('D')
    else:
        if count == i:
            cc.append('D')

        elif cnt==1:
            cnt=0
            cc.append('D')
        else:
            cnt=1
            cc.append('?')

ccc=1
for i in cc:
    if i=='P':
        print('P',end='')
    elif i=='D':
        print('D',end='')
    else:
        if i==len(cc):
            print('D')
        elif cc[ccc]=='P':
            print('D',end='')
        else:
            print('P',end='')
    ccc+=1

### FIXED CODE ###

T=str(input())
cnt=0
cc=[]
count=len(T)
for i in T:
    if i=='P':
        cnt=1
        cc.append('P')

    elif i=='D':
        cnt=0
        cc.append('D')
    else:
        if count == i:
            cc.append('D')

        elif cnt==1:
            cnt=0
            cc.append('D')
        else:
            cnt=1
            cc.append('?')

ccc=1
for i in cc:
    if i=='P':
        print('P',end='')
    elif i=='D':
        print('D',end='')
    else:
        if ccc==len(cc):
            print('D')
        elif cc[ccc]=='P':
            print('D',end='')
        else:
            print('P',end='')
    ccc+=1
mod = 10**9 + 7
n = int(input())
d = {}
for _ in range(n):
    a, b = map(int, input().split())
    if a/b in d:
        d[a/b] += 1
    else:
        d[a/b] = 1
ans = 1
for k in d.keys():
    if d[k] > 0:
        t = 2**d[k]
        if -1/k in d:
            t += 2**d[-1/k] - 1
            d[-1/k] = 0
        ans *= t
        ans %= mod
print(ans-1)

### FIXED CODE ###

import math
mod = 10**9 + 7
n = int(input())
d = {}
d0 = 0
for _ in range(n):
    a, b = map(int, input().split())
    g = math.gcd(a, b)
    if g == 0:
        d0 += 1
    else:
        a //= g
        b //= g
        if a < 0:
            a = -a
            b = -b
        elif a == 0 and b < 0:
            b = -b
        if (a,b) in d:
            d[(a,b)] += 1
        else:
            d[(a,b)] = 1
ans = 1
for (a,b) in d.keys():
    if d[(a,b)] > 0:
        t = 2**d[(a,b)]
        if b <= 0:
            a = -a
            b = -b
        if (b,-a) in d:
            t += 2**d[(b,-a)] - 1
            d[(b,-a)] = 0
        ans *= t
        ans %= mod
print((ans+d0-1)%mod)
N,M=map(int, input().split())

max = 0
min = 0

for _ in range(M):
    L,R = map(int, input().split())

    if min < L:
        min = L
    elif min == 0:
        min = L

    if max > R:
        max = R
    elif max =+ 0:
        max = R

ans = max - min + 1

print(ans)


### FIXED CODE ###

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

max = 0
min = 0

for _ in range(M):
    L,R = map(int, input().split())

    if min <= L:
        min = L
    elif min == 0:
        min = L

    if max >= R:
        max = R
    elif max == 0:
        max = R

ans = max - min + 1

if ans < 0:
    ans = 0

print(ans)
N = int(input())
for h in range(3500):
  for n in range(3500):
    w = (N*h*n) / (4*n*h - N*n - N*h)
    if w>0 and w.is_integer:
      print(h, n, int(w))

### FIXED CODE ###

N = int(input())
for h in range(3500):
  for n in range(h):
    try:w = (N*h*n) / (4*n*h - N*n - N*h)
    except ZeroDivisionError: continue
    if w>0 and w.is_integer():
      print(h, n, int(w))
      exit()
import math
def comb(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))
print(comb(n + m, 2) - n * m)


### FIXED CODE ###

n, m = map(int, input().split())
import math
def comb(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(comb(n + m, 2) - n * m)
from math import gcd, ceil


def prime_factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res


if __name__ == "__main__":
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    twos_cnt = {prime_factor(num).count(2) for num in a}
    if len(twos_cnt) > 1:
        print(0)
        exit()

    num_two = twos_cnt.pop()
    a_div = [x >> num_two for x in a]

    a_div_lcm = a_div[0]
    for i in range(1, n):
        a_div_lcm = a_div_lcm * a_div[i] // gcd(a_div_lcm, a_div[i])
    print(ceil(m / a_div_lcm * 0.5 - 0.5))


### FIXED CODE ###

from functools import reduce


def count_factors(a, factor):
    count = 0
    while a % factor == 0:
        count += 1
        a //= factor
    return count


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


if __name__ == "__main__":
    n, m = map(int, input().split())
    a = list(set(map(lambda x: int(x) // 2, input().split())))
    num_of_two = count_factors(a[0], 2)
    for ai in a[1:]:
        if count_factors(ai, 2) != num_of_two:
            print(0)
            exit()

    a_lcm = reduce(lambda x, y: lcm(x, y), a)
    if a_lcm > m:
        print(0)
        exit()

    print((m // a_lcm + 1) // 2)
import sys
sys.setrecursionlimit(10**3)

N, M, K = map(int,input().split())
tree = [-1 for _ in range(N)]
fc = [0] * N
bc = [0] * N
ans = [0] * N

def find(x):
    # x を引数に取り、xのroot番号を取得するメモ化再帰
    if tree[x] < 0:
        return x
    tree[x] = find(tree[x])
    return tree[x]

def unite(x, y):
    # x, y を引数に取り、x(自分)をy(相手)のrootに接続する関数
    rootx = find(x)
    rooty = find(y)
    if rootx == rooty:
        return
    if rootx < rooty:
        x , y = y, x
    tree[rooty] += tree[rootx]
    tree[rootx] = rooty

for m in range(M):
    a, b = map(int,input().split())
    fc[a-1] += 1
    fc[b-1] += 1
    unite(a-1, b-1)

for k in range(K):
    c, d = map(int,input().split())
    if find(c-1) == find(d-1):
        bc[c-1] += 1
        bc[d-1] += 1

for i in range(N):
    cnt = -tree[find(i)] - 1 - fc[i] - bc[i]
    ans[i] = cnt

print(*ans)

### FIXED CODE ###

N, M, K = map(int,input().split())
uf = [-1 for _ in range(N)]
fc = [0] * N
bc = [0] * N
ans = [0] * N

def find(x):
    # x を引数に取り、xのroot番号を取得するメモ化再帰
    if uf[x] < 0:
        return x
    uf[x] = find(uf[x])
    return uf[x]

def unite(x, y):
    # x, y を引数に取り、x(自分)をy(相手)のrootに接続する関数
    x = find(x)
    y = find(y)
    if x == y:
        return
    if x < y:
        x , y = y, x
    uf[y] += uf[x]
    uf[x] = y

for m in range(M):
    a, b = map(int,input().split())
    fc[a-1] += 1
    fc[b-1] += 1
    unite(a-1, b-1)

for k in range(K):
    c, d = map(int,input().split())
    if find(c-1) == find(d-1):
        bc[c-1] += 1
        bc[d-1] += 1

for i in range(N):
    cnt = -uf[find(i)] - 1 - fc[i] - bc[i]
    ans[i] = cnt

print(*ans)
a = input()
b = input()
c = input()
d = int

d = a
a = b
b = d 
d = c 
c = a
a = d
print(a,b,c)


### FIXED CODE ###

a,b,c = input().split()

d = int

d = a
a = b
b = d 
d = c 
c = a
a = d
print(a,b,c)
rom itertools import accumulate
def myAnswer(N:int,A:list) -> int:
   accum = list(accumulate(A))
   ans = 10**10
   now = accum.pop()
   for a in accum:
      if(abs(now - a - a) < ans):
         ans = abs(now - 2*a)
   return ans

   

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))
   print(myAnswer(N,A[:]))
if __name__ == '__main__':
   main()

### FIXED CODE ###

from itertools import accumulate
def myAnswer(N:int,A:list) -> int:
   accum = list(accumulate(A))
   ans = 10**10
   now = accum.pop()
   for a in accum:
      if(abs(now - a - a) < ans):
         ans = abs(now - 2*a)
   return ans

   

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))
   print(myAnswer(N,A[:]))
if __name__ == '__main__':
   main()
input=sys.stdin.readline
S = input()
size = len(S)
print(S[:1] + str(len(S[2:size])) + S[size-1:])

### FIXED CODE ###

S = input()
size = len(S)
print(S[:1] + str(len(S[2:size])) + S[size-1:])
1 S = input()
2 print(min(abs(int(S[i:i+3]) - 753) for i in range(len(S) - 3)))


### FIXED CODE ###

S = input()
print(min(abs(int(S[i:i+3]) - 753) for i in range(len(S) - 2)))
s = input()
b = "ABC"
r = "ARC"

if s == b:
  print("ARC")
else if s == r:
  print("ABC")


### FIXED CODE ###

s = input()
b = "ABC"
r = "ARC"

if s == b:
  print("ARC")
elif s == r:
  print("ABC")
N,M = map(int,input().split())
L,R = [list(map(int,input().split())) for _ in range(M)]
count = 0
for i in range(N+1):
  if i > max(L) and i < min(R):
    count += 1
print(count)

### FIXED CODE ###

N,M = map(int,input().split())
L = []
R = []
ans = 0
for _ in range(M):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)
ans = max(0,min(R) - max(L) + 1)
print(ans)
import sys

n= int(sys.stdin.readline())
ai= [ int(sys.stdin.readline()) for _ in range(n) ]
c= 1
l= [ -1 ]
for i in range(n-1):
    a = ai[i]
    k= -1
    for j in range(c):
        if l[j]<a:
            k= j
            break
    #
    if k>=0:
        l[k]= ai[i]
    else:
        c+=1
        l.append(None)
#
print( c )


### FIXED CODE ###

#!/usr/bin/env python

import sys

def DBsearch(L,x,narrow):
    n= len(L)
    if n==0: return 0
    if narrow and x in L: return L.index(x)
    last = L[-1]
    if x<last: return n
    if not narrow and x==last: return n
    #
    idx= -1
    i= 0
    j= n-1
    while j>=i:
        if i==j:
            if x>L[i]: idx= i
            break
        #
        mid= i + (j-i)//2
        if x<L[mid]:
            i= mid+1
        elif x==L[mid]:
            if narrow:
                idx= mid
                j  = mid - 1
            else:
                i = mid + 1
        else:
            idx= mid
            j= mid-1
    #
    return idx
#
def lds(L,narrow):
    seq= []
    for x in L:
        if len(seq)==0 or x<seq[-1]:
            seq.append(x)
        elif x==seq[-1]:
            if narrow:
                seq[DBsearch(seq,x,narrow)]= x
            else:
                seq.append(x)
        else:
            seq[DBsearch(seq,x,narrow)]= x
    #
    return len(seq)
#
n= int(sys.stdin.readline())
ai= [ int(sys.stdin.readline()) for _ in range(n) ]
print( lds( ai,False ) )
#Sunny
#Cloudy
#Rainy

tennki = input()
if tennki="Sunny":print("Cloudy")
elif tennki="Cloudy":print("Rainy")
else print("Sunny")


### FIXED CODE ###

#一日ごとに晴れ(Sunny)、くもり(Cloudy)、雨(Rainy)

tennki = input()
if tennki=="Sunny":print("Cloudy")
elif tennki=="Cloudy":print("Rainy")
else:print("Sunny")
import fraction

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

print(A * B // fraction.gcd(A, B))


### FIXED CODE ###

import fractions

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

print(A * B // fractions.gcd(A, B))
a,b=int(input().split())
print(a+b,a-b,a*b)


### FIXED CODE ###

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

print(max(a+b,a-b,a*b))
l=list(map(int,input().split()))
a=l[0]
b=l[1]
n=l[2]
if b-1<n:
  i=b-1
else:
  i=n
y=(((a*i)/b)//1)-(a*((i/b)//1))
print(int(y))

### FIXED CODE ###

k=int(input())
l=list(map(int,input().split()))
x=l[0]//k
if(x*k==l[0] or k*(x+1)<=l[1]):
  print("OK")
else:
  print("NG")
n=int(input())
cnt_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

### FIXED CODE ###

n=int(input())
cnt_10=0
MAX_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)
n = int(input())
li =[list(map(int,input().split())) for i in range(1,n+1)]

cnt = 0
check = []
kouho = [i for i in range(1,n+1)]
play = 0

while play < n*(n-1) // 2:
    s = play
    for i in kouho:
        if i in check or len(li[i-1]) == 0:
            continue
        temp = li[i-1][0]
        if li[temp-1][0] == i and temp not in check:
            del li[i-1][0]
            del li[temp-1][0]
            play += 1
            check.append(i)
            check.append(temp)
    cnt += 1
    kouho = check.copy()
    check = []
    
    if s == play:
        print(-1)
        exit()

print(cnt)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]
 
A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        if A[n][-1] != -1:
            cand1.add(A[n][-1])
    return len(can_use), cand1
    
answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break
    
print(answer)
n = int(input())
l = list(range(2, n+1))
l.append(1)
ans = 0
for i, m in enumerate(l): ans += (i+1)%m
print(ans)

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
n = int(input())
if n % 2 != 0:
  print(0)
else:
  while n:
    ans += n
  print(n)

### FIXED CODE ###

n = int(input())
if n % 2 != 0:
  print(0)
else:
  ans = 0
  while n:
    n //= 5
    ans += n // 2
  print(ans)
class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
        self.el = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s
    def add(self, i, x):
        # assert i > 0
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    def get(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.sum(j) - self.sum(i)

n = int(input())
s = input()
q = int(input())

bit = [BIT(n) for i in range(26)]
for i in range(n):
    bit[ord(s[i])-97].add(i+1, 1)
s = list(s)
for _ in range(q):
    query, i, c = input().split()
    if query == "1":
        i = int(i)
        c = ord(c)-97
        if bit[c].get(i) == 0:
            bit[c].add(i+1, 1)
            bit[ord(s[i])-97].add(i+1, -1)
            s[i] = chr(c+97)
    else:
        ans = 0
        for k in range(26):
            if bit[k].get(int(i)-1, int(c)) >= 1:
                ans += 1
        print(ans)


### FIXED CODE ###

#1indexed
class BIT():
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n+1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += i & -i

n = int(input())
s = input()
q = int(input())

bit = [BIT(n+1) for i in range(26)]
for i in range(n):
    bit[ord(s[i])-97].add(i+1, 1)


s = list(s)
for _ in range(q):
    query, a, b = input().split()
    if query == "1":
        i = int(a)
        c = ord(b)-97
        bit[ord(s[i-1])-97].add(i, -1)
        bit[c].add(i, 1)
        s[i-1] = b
    else:
        ans = 0
        for k in range(26):
            if bit[k].sum(int(b))-bit[k].sum(int(a)-1) >= 1:
                ans += 1
        print(ans)
def cal(sgn, n1, n2):
    return n1 + n2 if sgn == '+' else n1 - n2


A, B, C, D = map(int, list(input()))
sgns = []
for bit in range(1<<3):
    tmp = ['+'] * 3
    for i in range(3):
        if ((bit>>i) & 1) == 1:
            tmp[i] = '-'
    sgns.append(tmp)

for sgn in sgns:
    if cal(sgn[2], cal(sgn[1], cal(sgn[0], A, B), C), D) == 7:
        print(f'{A}{sgn[0]}{B}{sgn[1]}{C}{sgn[2]}{D}=7')
        exit()

### FIXED CODE ###

def cal(sgn, n1, n2):
    return n1 + n2 if sgn == '+' else n1 - n2


A, B, C, D = map(int, list(input()))
sgns = []
for bit in range(1<<3):
    tmp = ['+'] * 3
    for i in range(3):
        if ((bit>>i) & 1) == 1:
            tmp[i] = '-'
    sgns.append(tmp)

for sgn in sgns:
    if cal(sgn[2], cal(sgn[1], cal(sgn[0], A, B), C), D) == 7:
        print('{0}{1}{2}{3}{4}{5}{6}=7'.format(A, sgn[0], B, sgn[1], C, sgn[2], D))
        exit()