Harryxun/stf_run huggingface dataset:
n,u,v = map(int, input().split())
adjacent_list = [[]for i in range(n+1)]
aoki = [-1 for i in range(n+1)]
takahashi = [-1 for i in range(n+1)]
for i in range(n-1):
    a,b = map(int ,input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)

def dfs(node, count,li):
    li[node] = count
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i, count + 1,li)

def search_path(node,t):
    if node == t:
        return
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            pre_node[i] = node
            search_path(i, t)

finished = set()
dfs(v,0,aoki)
finished = set()
path = []
pre_node = [0 for i in range(n+1)]
#最短炉を出す
search_path(u,v)
while v != u:
    path = [v] + path
    v = pre_node[v]
start = u
for i in range(len(path)-1):
    if aoki[path[i+1]] <= i+1:
        start = path[i]
        break
finished = set(path)
ans = [0 for i in range(n+1)]
dfs(start,0,ans)
print(max(ans) + aoki[start] - 1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n,u,v = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
aoki = [0 for i in range(n+1)]
takahashi = [0 for i in range(n+1)]
for i in range(n-1):
    a,b = map(int ,input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)

def dfs(node, count,li):
    global node_par
    li[node] = count
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            node_par[i] = node
            dfs(i, count + 1,li)
        
node_par = [0 for i in range(n+1)]

finished = set()
dfs(u,0,takahashi)

#辿って親保存しとく
finished = set()
dfs(v,0,aoki)

#さかのぼれるとこまで行く,startがさかのぼれる最大のノーど
par = u
start = u
while takahashi[par] < aoki[par]:
    start = par
    par = node_par[start]

ans_height = [0 for i in range(n+1)]
finished = set([node_par[start]])
dfs(start,0,ans_height)
print(max(ans_height) + aoki[start] - 1)
n = int(input())
count = 0;

for i in range(n):
  if i % 3 != 0 && i % 5 != 0:
    count+=i
   
print(i)

### FIXED CODE ###

n = int(input())
count = 0;
 
for i in range(n):
  if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
    count+=(i+1)
   
print(count)
import sys

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[(1+p)/2 for p in P]
temp=sum(Q[:K])
ans=temp
for a,i in enumerate(range(N-4)):
  temp=temp-Q[i]+Q[i+K]
  ans=max(ans,temp)
else:
  print(ans)


### FIXED CODE ###

import sys

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[(1+p)/2 for p in P]
temp=sum(Q[:K])
ans=temp
for i in range(N):
  try:
    temp=temp-Q[i]+Q[i+K]
    ans=max(ans,temp)
  except:
    pass
else:
  print(ans)
from functools import reduce

X,Y,A,B,C=map(int, input().split())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))

x=X-1
y=Y-1

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r,reverse=True)


if p[x]>=q[y]:
  a=q[y]
  f=1
else:
  a=p[x]
  f=2
while a<r[0] and len(r)>=1:
  if f==1 :
    q[y]=r[0]
    y-=1
    r.pop(0)
  elif f==2 :
    p[x]=r[0]
    x-=1
    r.pop(0)
  else:
    break
  if (y==-1 and x>=0) or (x>=0 and p[y]>q[x]):
    a=p[x]
    f=2
  elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):
    a=q[y]
    f=1
  else:
    break

ans=0
for i in p[:X]:
  ans+=i
for i in q[:Y]:
  ans+=i

print(ans)

### FIXED CODE ###

X,Y,A,B,C=map(int, input().split())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))

x=X-1
y=Y-1

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r,reverse=True)

#print(p[:X],q[:Y])

if p[x]>=q[y]:
  a=q[y]
  f=1
else:
  a=p[x]
  f=2
while len(r)>=1 and a<r[0]:
#  print(a,r[0])
  if f==1 :
#    print('f=1')
    q[y]=r[0]
    y-=1
    r.pop(0)
  elif f==2 :
#    print('f=2')
    p[x]=r[0]
    x-=1
    r.pop(0)
  else:
#    print('break1')
    break
    
#  print(x,y,p[x],q[y])
    
  if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):
#    print('a=p[x]')
    a=p[x]
    f=2
  elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):
#    print('a=q[y]')
    a=q[y]
    f=1
  else:
#    print('break2')
    break

ans=0
#print(p[:X],q[:Y])
for i in p[:X]:
  ans+=i
for i in q[:Y]:
  ans+=i

print(ans)
s = input()

l = len(s)//2
if l%2==0:
    s1 = s[:l]
    s2 = s[l:]
else:
    s1 = s[:l]
    s2 = s[l+1:]

s2=s2[::-1]
c=0
for i in range(len(s2)):
    if s1[i] != s2[i]:
        c+=1
print(c)

### FIXED CODE ###

S = input()
cnt = 0

for i in range(len(S)//2):
    if S[i] != S[-(i+1)]:
        cnt += 1
print(cnt)
import math

def lcm(x, y):
    return math.floor((x * y) / math.gcd(x, y))

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

ans = 0
p = lcm(c, d)

a_under = a-1

ans = (b - math.floor(b/c) - math.floor(b/d) + math.floor(b/p)) - (a_under - math.floor(a_under/c) - math.floor(a_under/d) + math.floor(a_under/p))

print(ans)

### FIXED CODE ###

from fractions import gcd
a, b, c, d = map(int, input().split())

p = (c * d) // gcd(c, d)

a_under = a-1

ans = (b - b//c - b//d + b//p) - (a_under - a_under//c - a_under//d + a_under//p)

print(ans)
i = list(map(int, input().split()))
if i[0] == 7:
  if i[1] == 5 and i[2] ==5:
    print('YES')
  else:
    print('NO')
elif i[0] == 5:
  if (i[1] == 7 and i[2] == 5) or (i[2] == 7 and i[1] == 5):
    print('YES')
  else:
    print('NO')
else:
  print('NO')

### FIXED CODE ###

i = list(map(int, input().split()))
if i[0] == 7:
  if i[1] == 5 and i[2] ==5:
    print('YES')
  else:
    print('NO')
elif i[0] == 5:
  if (i[1] == 7 and i[2] == 5) or (i[2] == 7 and i[1] == 5):
    print('YES')
  else:
    print('NO')
else:
  print('NO')
h,n = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print("Yes") if a[0] + a[1] > h else print("No")

### FIXED CODE ###

h,n = map(int, input().split())
a = list(map(int, input().split()))
print("Yes") if sum(a) >= h else print("No")
A,B = map(float,input().split())
print(int(A*B)

### FIXED CODE ###

A,B = input().split()
a = int(A)
b1 = int(B[0])*100
b2 = int(B[2])*10
b3 = int(B[3])

answer = a*(b1+b2+b3) // 100
print(answer)
# @author 

import sys

class EVirusTree2:

    def solve(self):
        from collections import defaultdict
        import sys
        # sys.setrecursionlimit(10 ** 5 + 5)

        MOD = 10 ** 9 + 7
        n, k  = [int(_) for _ in input().split()]
        adj = defaultdict(list)
        for i in range(n - 1):
            a, b = [int(_) for _ in input().split()]
            a -= 1
            b -= 1
            adj[a].append(b)
            adj[b].append(a)
        done = [0] * n
        def dfs(s, rem):
            done[s] = 1
            if rem < 0:
                return 0
            res = 1
            for x in adj[s]:
                if done[x]:
                    continue
                if rem <= 0:
                    return 0
                res = (res * rem) % MOD
                res = (res * dfs(x, k - 2)) % MOD
                rem -= 1
                if res == 0:
                    return 0
            return res

        print((dfs(0, k - 1) * k) % MOD)




solver = EVirusTree2()
input = sys.stdin.readline

solver.solve()


### FIXED CODE ###

# @author 

import sys

class EVirusTree2:

    def solve(self):
        from collections import defaultdict
        import sys
        sys.setrecursionlimit(10 ** 5 + 5)

        MOD = 10 ** 9 + 7
        n, k  = [int(_) for _ in input().split()]
        adj = defaultdict(list)
        for i in range(n - 1):
            a, b = [int(_) for _ in input().split()]
            a -= 1
            b -= 1
            adj[a].append(b)
            adj[b].append(a)
        done = [0] * n
        def dfs(s, rem):
            done[s] = 1
            if rem < 0:
                return 0
            res = 1
            for x in adj[s]:
                if done[x]:
                    continue
                if rem <= 0:
                    return 0
                res = (res * rem) % MOD
                res = (res * dfs(x, k - 2)) % MOD
                rem -= 1
                if res == 0:
                    return 0
            return res

        print((dfs(0, k - 1) * k) % MOD)




solver = EVirusTree2()
input = sys.stdin.readline

solver.solve()
A,B = map(int,raw_input().split())
ans = A
for i in range(A+1,B+1):
  ans = ans^i
print ans


### FIXED CODE ###

A,B = map(long,raw_input().split())

sum = B-A+1

if sum % 2 == 0:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print "0"
    else:
      print "1"
  else:
    if sum/2%2 == 1:
      print A^B^0
    else:
      print A^B^1
else:
  if A % 2 == 0:
    if sum/2%2 == 0:
      print 0^B
    else:
      print 1^B
  else:
    if sum/2%2 == 1:
      print 1^A
    else:
      print 0^A
s = input()
answer = 0

if len(s) == 1:
    print(s)
for i in range(2**(len(s)-1)):
    f = s[0]
    for j,b in enumerate(str(format(i,'b').zfill(len(s)-1))):
        if b == '1':
           f += ','
        f += s[j+1]
    answer += sum(int(i) for i in f.split(','))
print(answer)


### FIXED CODE ###

s = input()
answer = 0

if len(s) == 1:
    print(s)
else:
    for i in range(2**(len(s)-1)):
        f = s[0]
        for j,b in enumerate(str(format(i,'b').zfill(len(s)-1))):
            if b == '1':
               f += ','
            f += s[j+1]
        answer += sum(int(i) for i in f.split(','))
    print(answer)
n,k = map(int, input().split())
a=[int(input()) for i in range(n)]

ide_ele = 0

def segfunc(x, y):
    return max(x,y)

class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r): #[l, r) 0-index
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

al = [0]*(n+1)
seg = SegTree(al, segfunc, ide_ele)

for num in a:
    l=max(0,num-k)
    r=min(n,num+k+1)
    mx = seg.query(l,r)
    seg.update(num,mx+1)

print(seg.query(0,n))

### FIXED CODE ###

n,k = map(int, input().split())
a=[int(input()) for i in range(n)]

ide_ele = 0

def segfunc(x, y):
    return max(x,y)

class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r): #[l, r) 0-index
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

maxa=max(a)
al = [0]*(maxa+1)
seg = SegTree(al, segfunc, ide_ele)

for num in a:
    l=max(0,num-k)
    r=min(maxa,num+k)
    mx = seg.query(l,r+1)
    seg.update(num,mx+1)

print(seg.query(0,maxa+1))
import numpy as np

H, W, M = map(int, list(input().split()))
hw = [list(map(int, list(input().split()))) for i in range(M)]
hw = np.array(hw) - 1

sh = [0] * H
sw = [0] * W
bomb = np.zeros((H, W), dtype=int)
for i in range(M):
    sh[hw[i, 0]] += 1
    sw[hw[i, 1]] += 1
    bomb[hw[i, 0], hw[i, 1]] = 1

h_list = [i for i, x in enumerate(sh) if x == max(sh)]
w_list = [i for i, x in enumerate(sw) if x == max(sw)]
    
print(6)

### FIXED CODE ###

H, W, M = map(int, input().split())
hw = []
sh = [0] * H
sw = [0] * W
for i in range(M):
    h, w = map(int, input().split())
    hw.append((h - 1, w - 1))

    sh[h - 1] += 1
    sw[w - 1] += 1

mh = max(sh)
mw = max(sw)

count = 0
for i in range(M):
    if sh[hw[i][0]] == mh and sw[hw[i][1]] == mw:
        count += 1

if sh.count(mh) * sw.count(mw) > count:
    print(mh + mw)
else:
    print(mh + mw - 1)
n=int(input())
l=list(range(1,n+1))
l=sorted(l,reverse=True)
ans=0
for i in l:
    if pow(i,0.5)%1==0:
        ans=i
        break
        
print(ans)

### FIXED CODE ###

n=int(input())
sq=n**0.5//1
print(int(sq**2))
k=int(input())
l=[int(x) for x in input().rstrip().split()]
a=[]
 
for i in l:
    for j in l:
        if i<j:
            a.append([i,j])
 
A_1=0
A_2=0
SUM=0
ans=""
ANS=[]
for i in range(len(a)):
    A_1=format(a[i][0],'b')
    A_2=format(a[i][1],'b')
    if len(A_1)<len(A_2):
        A_1='0'*(len(A_2)-len(A_1))+A_1
    elif len(A_2)<len(A_1):
        A_2='0'*(len(A_1)-len(A_2))+A_2
 
 
    for j in range(len(A_1)):
        if A_1[j]==A_2[j]:
            ans=ans+'0'
        else:
            ans=ans+'1'
    ANS.append(ans)
    SUM+=int(ans,2)
    ans=''
SUM=SUM%(10**9+7)
print(SUM)

### FIXED CODE ###

a=[int(x) for x in input().rstrip().split()]
if 22<=sum(a):
    print("bust")
else:
    print("win")
A, B, C, D, E = [int(input()) for _ in range(5)]

menu = [A, B, C, D, E]

time_dig = [-(-food // 10) for food in menu]
time_min_mod_10 = min([_ % 10 for _ in menu if _ % 10 != 0])

print((sum(time_dig) - 1) * 10 + time_min_mod_10)

### FIXED CODE ###

A, B, C, D, E = [int(input()) for _ in range(5)]

menu = [A, B, C, D, E]

time_dig = [-(-food // 10) for food in menu]
time_mod_10 = [_ % 10 for _ in menu if _ % 10 != 0]
time_mod_10.append(10)

print((sum(time_dig) - 1) * 10 + min(time_mod_10))
import sys
a = []
for l in sys.stdin:
    a.append(l)
p = input() .split()
s = set()
for i in range(1, len(p)):
    s.add(p[i])
print(len(set(s)))

### FIXED CODE ###

n = int(input())
p = [input() for i in range(n)]
s = set()
for i in range(n):
    s.add(p[i])
print(len(s))
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sumA = 0
sumB = 0

for i in range(n):
    sumA = A[i] + sumA
    sumB = B[i] + sumB

if sumA <= sumB:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

x, y =  map(int, input().split())
i = 1
if x % y == 0:
    print(-1)
else:
    for i in range(10 ** 18 + 1):
        if (i * x) % y != 0:
            print(i * x)
            break
        else:
            continue
X = int(input())
rad = 90
cnt = 0

while True:
    cnt += 1
    if rad==360:
        break
    else:
        rad += X
        rad = rad if rad < 360 else rad = 360

print(cnt)

### FIXED CODE ###

X = int(input())

eikaku = X if X < 180 else X - 180
cnt = 0

ans = 0
while True:
    ans += 1
    cnt += eikaku
    if cnt % 360 == 0:
        print(ans)
        break
a=input()
s=list(map(int,input().split()))
count=0
min=s[0]
for i in range(1,a):
    if min>s[i] :
        count+=1
        min=s[j]
print(count) 

### FIXED CODE ###

a=int(input())
s=list(map(int,input().split()))
count=0
min=s[0]
for i in range(0,a):
    if min>=s[i]:
        count+=1
        min=s[i]
print(count)
a,b,v,w,t = int(input())

d = abs(b-a)
u = vt
o = wt
p = abs(wt-vt)

if p>=d:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
    print('NO')
else:
    if 1 <= (abs(b - a) / (v - w)) <= t:
        print('YES')
    else:
        print('NO')
A,B,T=map(int,input().split())
a =T//A
 number = 0
 for i in range(a):
  b=1
  s = a-b
  if s >0:
    number+=1
  b+=1
print(number*B)

  

### FIXED CODE ###

A,B,T = map(int,input().split())
a =T//A
number = 0
for i in range(a):
  b=1
  s = a-b
  if s >=0:
    number+=1
  b+=1
print(number*B)
n=int(input())
e = [[int(i) for i in input().split()] for i in range(n)]
h=0
for x in range(0,101):
    for y in range(0,101):
        f=0
        if e[f][2]==0:
            f+=1
        else:
            k=abs(x-e[f][0])+abs(y-e[f][1])+e[f][2]
        for i in range(0,len(e)):
            if e[i][2]!=max(k-abs(x-e[i][0])-abs(y-e[i][1]),0):
                break
        else:
            print(x,y,k)

### FIXED CODE ###

n=int(input())
e = [[int(i) for i in input().split()] for i in range(n)]
h=0
for a in range(n):
    if e[a][2]>0:
        s=a
        break
for x in range(0,101):
    for y in range(0,101):
            k=abs(x-e[s][0])+abs(y-e[s][1])+e[s][2]
            for i in range(0,n):
                if e[i][2]!=max(k-abs(x-e[i][0])-abs(y-e[i][1]),0):
                    break
            else:
                print(x,y,k)
n, k = map(int, input().split())
pr = list(map(int, input().split()))

pr.sort()

print(sum(pr[0:k])

### FIXED CODE ###

n, k = map(int, input().split())
pr = list(map(int, input().split()))
 
pr.sort()
 
print(sum(pr[0:k]))
import sys
nums = [for i in map(int, sys.stdin.readline().split())]
counted = []
cnt = 0
for item in nums:
    if item in counted:
        continue
    else:
        cnt += 1
        counted.append(item)

print(cnt)

### FIXED CODE ###

import sys
a, b, c = map(int, sys.stdin.readline().split())
nums = []
nums.append(a)
nums.append(b)
nums.append(c)

counted = []
cnt = 0
for item in nums:
    if item in counted:
        continue
    else:
        cnt += 1
        counted.append(item)
print(cnt)
import math
import copy

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        c = math.gcd(x[0], x[1])
        for i in range(2,N-1):
            c = math.gcd(c,x[i])
        if c >= max:
            max = c
        x.clear()
    print(max)


### FIXED CODE ###

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

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)
n = int(input())
lst = [135, 189, 105, 165, 195]
tmp = 0

for i in range(6):
    if n<=lst[i]:
        tmp += 1

print(tmp)

### FIXED CODE ###

n = int(input())
lst = [135, 189, 105, 165, 195]
tmp = 0
x = []

for i in range(5):
    x.append(n-lst[i])

for i in range(5):
    if x[i]>=0:
        tmp += 1

print(tmp)
h, w = map(int, input().split())
boad = h * w
if w == 1 and h == 1:
  print(1)
else:
  print((boad + 1) // 2)


### FIXED CODE ###

k = int(input())
num_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(num_list[k -1])
n,m=map(int,raw_input().split())
p=map(int,raw_input().split())
abc=[map(int,raw_input().split()) for _ in xrange(n-1)]
cnt=[0]*(n-1)
for i in xrange(m-1):
    p[i]-=1
    p[i+1]-=1
    if p[i]<p[i+1]:
        for j in xrange(p[i],p[i+1]):
            cnt[j]+=1
    else:
        for j in xrange(p[i],p[i+1],-1):
            cnt[j-1]+=1
    p[i]+=1
    p[i+1]+=1

ans=0
for i in xrange(n-1):
    ans+=min(abc[i][0]*cnt[i],abc[i][1]*cnt[i]+abc[i][2])
print(ans)

### FIXED CODE ###

n,m=map(int,raw_input().split())
p=map(int,raw_input().split())
abc=[map(int,raw_input().split()) for _ in xrange(n-1)]
cnt=[0]*n

for i in xrange(m-1):
    p[i]-=1
    p[i+1]-=1
    if p[i]<p[i+1]:
        cnt[p[i]]+=1
        cnt[p[i+1]]-=1
    else:
        cnt[p[i]]-=1
        cnt[p[i+1]]+=1
    p[i]+=1
    p[i+1]+=1
    
for i in xrange(n-1):
    cnt[i+1]+=cnt[i]
    
ans=0
for i in xrange(n-1):
    ans+=min(abc[i][0]*cnt[i],abc[i][1]*cnt[i]+abc[i][2])
    
print(ans)
def dfs(array: list, index: int, calc: str, result: int):
    if index == len(array):
        if result == 7:
            print("{}=7".format(calc))
            exit(0)

    if index == 0:
        test(array, index + 1, array[index], int(array[index]))
    elif index < len(array):
        test(array, index + 1, calc + "-" + array[index], result - int(array[index]))
        test(array, index + 1, calc + "+" + array[index], result + int(array[index]))

array = list(input())
test(array, 0, "", 0)

### FIXED CODE ###

def dfs(i: int, t: int, op: str):
  if i == 3:
    if t == 7:
      return op
    else:
      return ""

  return dfs(i + 1, t + s[i + 1], op + "+") + dfs(i + 1, t - s[i + 1], op + "-")

s = list(map(int, list(input())))
op = ""

op = dfs(0, s[0], op)
ans = str(s[0]) + op[0] + str(s[1]) + op[1] + str(s[2]) + op[2] + str(s[3]) + "=7"
print(ans)
from collections import deque
K = int(input())
q = deque(str(i) for i in range(1, 10))
cnt = 9
if K < 10:
    print(K); return
while True:
    tmp = q.popleft()
    las = int(tmp[-1])
    for i in range(las-1, las+2):
        if 0<=i<=9:
            q.append(tmp + str(i))
            cnt += 1
            if cnt==K:
                print(q.pop()); return

### FIXED CODE ###

def resolve():
	from collections import deque
	K = int(input())
	q = deque(str(i) for i in range(1, 10))
	cnt = 9
	if K < 10:
		print(K); return
	while True:
		tmp = q.popleft()
		las = int(tmp[-1])
		for i in range(las-1, las+2):
			if 0<=i<=9:
				q.append(tmp + str(i))
				cnt += 1
				if cnt==K:
					print(q.pop()); return
resolve()
S = input()
max = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        for j in range(i+1, len(S)):
            if not S[j] in 'ACGT':
                break
        max = (j - i) if max < (j - i) else max 
print(max)


### FIXED CODE ###

s = input()
z = ''
ans = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        ans = max(ans, 1)
        for j in range(i+1, len(s)):
            if s[j] in 'ACGT':
                ans = max(ans, j-i+1)
            else:
                break
    else:
        continue
print(ans)
n, k, s = map(int, input().split())
if s == 10**9:
    a = 10**9-1
else:
    a = 10**9
l = [a for _ in range(n)]

if s % 2 == 0:
    l[0:k+1] = [s//2 for _ in range(k+1)]
else:
    s, t = (s-1)//2, (s+1)//2
    for i in range(k+1):
        if i % 2 == 0:
            l[i] = s
        else:
            l[i] = t

print(l)


### FIXED CODE ###

n, k, s = map(int, input().split())
if s == 10**9:
    a = 10**9-1
else:
    a = 10**9
l = [a for _ in range(n)]

if k == n:
    print(' '.join(map(str, [s for _ in range(n)])))
elif k == 0:
    print(' '.join(map(str, l)))
else:
    if s == 1:
        l[0:k] = [s for _ in range(k)]
    elif s % 2 == 0:
        l[0:k+1] = [s//2 for _ in range(k+1)]
    else:
        u, t = (s-1)//2, (s+1)//2
        for i in range(k+1):
            if i % 2 == 0:
                l[i] = u
            else:
                l[i] = t

    print(' '.join(map(str, l)))
from scipy.special import comb
n=[int(i) for i in input().split()]
a=comb(n[0],2,exact=True)
b=comb(n[1],2,exact=True)
print(a+b)

### FIXED CODE ###

from scipy.misc import comb
n=[int(i) for i in input().split()]
a=comb(n[0],2,exact=True)
b=comb(n[1],2,exact=True)
print(a+b)
H,W,A,B = map(int,input().split())

mod = 10**9 + 7

f = [1]
for i in range(H+W):
    f.append(f[i]*(i+1)%mod)

def comb(A,B,mod):
    return f[A] * pow(f[B],mod-2,mod) * pow(f[a-b],mod-2,mod) % mod

res = 0

for i in range(B,W):
    res += comb(H-A+i-1,i,mod) * comb(A+W-i-2,A-1,mod) % mod

print(res%mod)

### FIXED CODE ###

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

mod = 10**9 + 7

f = [1]
for i in range(H+W):
    f.append(f[i]*(i+1)%mod)

def comb(A,B,mod):
    return f[A] * pow(f[B],mod-2,mod) * pow(f[A-B],mod-2,mod) % mod

res = 0

for i in range(B,W):
    res += comb(H-A+i-1,i,mod) * comb(A+W-i-2,A-1,mod) % mod

print(res%mod)