Harryxun/stf_run huggingface dataset:
joukyuukokuminndomo=input().split(' ')
joukyuukokuminn2=int(joukyuukokuminndomo[0])
simojimo2=int(joukyuukokuminndomo[1])
joukyuukokuminn=joukyuukokuminn2
simojimo=simojimo2

while joukyuukokuminn%simojimo!=0:
  if joukyuukokuminn>simojimo:
    joukyuukokuminn=joukyuukokuminn-simojimo
  elif joukyuukokuminn<simojimo:
    simojimo=simojimo-joukyuukokuminn

if joukyuukokuminn>simojimo:
  print(joukyuukokuminn2*simojinn2/simojimo)
elif joukyuukokuminn<simojimo:
  print(joukyuukokuminn2*simojinn2/joukyuukokuminn)


### FIXED CODE ###

joukyuukokuminndomo=input().split(' ')
joukyuukokuminn2=int(joukyuukokuminndomo[0])
simojimo2=int(joukyuukokuminndomo[1])
joukyuukokuminn=joukyuukokuminn2
simojimo=simojimo2

while joukyuukokuminn%simojimo!=0:
  if joukyuukokuminn>simojimo:
    joukyuukokuminn=joukyuukokuminn-simojimo
  elif joukyuukokuminn<simojimo:
    simojimo=simojimo-joukyuukokuminn

if joukyuukokuminn>=simojimo:
  print(int(joukyuukokuminn2*simojimo2/simojimo))
elif joukyuukokuminn<simojimo:
  print(int(joukyuukokuminn2*simojimo2/joukyuukokuminn))
N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = -1
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)


### FIXED CODE ###

N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)
l=input().split() 
n = list(map(int, input().split()))
t=input()
if l[0]==t:
    n[0]=n-1
    print(n)
elif l[1]==t:
    n[1]=n-1
    print(n)

### FIXED CODE ###

l=input().split() 
n = list(map(int, input().split()))
t=input()
if l[0]==t:
    n[0]=n[0]-1
    print(n[0],n[1])
elif l[1]==t:
    n[1]=n[1]-1
    print(n[0],n[1])
from collections import Counter

N = int(input())
s = []
for i in range(N):
    s.append(Counter(input()))

ans = 0
for i in range(N):
  for j in range(i+1, N):
    if(s[i] == s[j]):
      ans += 1
    
print(ans)

### FIXED CODE ###

A,B = map(int, input().split())
print(max(A+B, A-B, A*B))
S = input()
if S == "AAA" or B == "BBB":
  print("No")
else:
  print("Yes")
  

### FIXED CODE ###

S = raw_input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")
#import numpy as np
#import collections
#import math

f = open('./input_E.txt')

N,K = map(int, f.readline().split())
A = list(map(int, f.readline().split()))

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

A.sort(reverse=True)

def nibu(small,big):
    mid = (small+big)//2
#    k_list = [x//mid for x in A2]
    k_list = [x//mid for x in A]
    sum_k = sum(k_list)
    if sum_k <= K: #達成可能 -> 答えはもっと小さい
        return small,mid # 不可能,可能
    else:
        return mid,big # 不可能,可能


if N==1 or K==0:
    ans = A[0]
else:    
#    All_length = sum(A)
#    KK = K+N-1
#    lmin = int(All_length/(KK+1))
    lmin = 0
    
#    A2 = [x for x in A if x > lmin]
    
#    Kper1 = K//len(A2)
    
#    lmax = int(A[0]/(Kper1+1)) + 1
    lmax = A[1]
    
    while lmax - lmin >= 2:
        lmin, lmax = nibu(lmin,lmax)
    
    ans = lmax
    
print(ans)

### FIXED CODE ###

#import numpy as np
#import collections
#import math

#f = open('./input_E.txt')
#
#N,K = map(int, f.readline().split())
#A = list(map(int, f.readline().split()))

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

A.sort(reverse=True)

def nibu(small,big,KK,AA):
    mid = (small+big)//2
    k_list = [(x-1)//mid for x in AA]
    sum_k = sum(k_list)
    if sum_k <= KK: #達成可能 -> 答えはもっと小さい
        return small,mid # 不可能,可能
    else:
        return mid,big # 不可能,可能


if K==0:
    ans = A[0]
else:    
    lmin = 0
    lmax = A[0]
    
    while lmax - lmin >= 2:
        lmin, lmax = nibu(lmin,lmax,K,A)
    
    ans = lmax
    
print(ans)
def is_substring(s,t,start_index):
	ok=True
	j=0
	for i in range(start_index, start_index + max(len(s) - len(t) + 1,0)):
		if s[i] == t[j] or s[i] == '?':
			j+=1
		else:
			ok = False
			break
	return ok


def replace(s_list, index, changed_char):
	s_list[index] = changed_char
	t = "".join(s_list)
	return t

def main():
	s=str(input())
	t=str(input())
	s_list = list(s)

	ok=False
	for i in range(max(len(s) - len(t) + 1,0)):
		j=0
		if s[i] == t[j] or s[i] == '?':
			if is_substring(s,t,i) == True:
				k=i
				for j in range(len(t)):
					s = replace(s_list, k, t[j])
#				s[k] = t[j]
					k+=1
				ok=True
				break

	if ok == True:
		for i in range(len(s)):
			if (s[i] == '?'):
				s = replace(s_list, i, 'a')

	print(s if ok == True else "UNRESTORABLE")

if __name__ == '__main__':
	main()

### FIXED CODE ###

S = input()
T = input()
ok = False
ans = []

for i in range(len(S)-len(T),-1,-1):
	tmpS = list(S)
	for j in range(len(T)):
		if tmpS[i+j] == "?":
			tmpS[i+j] = T[j]

	if "".join(tmpS[i:i+len(T)]) == T:
		ans = tmpS
		ok = True
		break

ans = "".join(ans)
if ok == False:
	print("UNRESTORABLE")
else:
	print(ans.replace("?","a"))
S,T=input().split()
A,B=(int(x) for x in input().split())
U = input()

if S == U:
  A = A - 1
  print(A B)
  
else:
  B = B - 1
  print(A B)

### FIXED CODE ###

S,T=input().split()
A,B=(int(x) for x in input().split())
U = input()
 
if S == U:
  A = A - 1
  print(A, B)
  
else:
  B = B - 1
  print(A, B)
import sys

N = int(sys.stdin.readline())

stones = []
for _ in range(N):
    stones.append(int(sys.stdin.readline()))

left = [-1] * (N+1) # 1-indexed
dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    dp[i] = dp[i-1]
    # 同じ色が前回出現した位置
    if left[stones[i-1]] != -1 and left[stones[i-1]] != i - 1:
        dp[i] += dp[left[stones[i-1]]]
    
    left[stones[i-1]] = i

print(dp[-1])

### FIXED CODE ###

import sys

mod = 10**9 + 7
N = int(sys.stdin.readline())

stones = []
for _ in range(N):
    stones.append(int(sys.stdin.readline()))

left = [-1 for _ in range(2*10**5+1)]
dp = [0 for _ in range(N+5)]
dp[0] = 1
for i in range(N):
    dp[i+1] = dp[i]
    # 同じ色が前回出現した位置
    c = stones[i]
    if 0 <= left[c] < i - 1:
        dp[i+1] += dp[left[c] + 1]
    
    dp[i+1] %= mod
    left[c] = i

print(dp[N])
n, k = map(int, input().split())
A = list(map(int, input().split()))
ng = -1
ok = max(A) + 1
def test(x):
    cnt = 0
    for a in A:
        if a > x:
            cnt += -(-a//x) - 1
    return cnt <= k

while ok - ng > 1:
    mid = (ok+ng) // 2
    if test(mid):
        ok = mid
    else:
        ng = mid
print(ok)


### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))
ng = -1
ok = max(A) + 1
def test(x):
    if x == 0:
      return False
    cnt = 0
    for a in A:
        if a > x:
            cnt += -(-a//x) - 1
    return cnt <= k

while ok - ng > 1:
    mid = (ok+ng) // 2
    if test(mid):
        ok = mid
    else:
        ng = mid
        
print(ok)
N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))
points=[[] for i in range(N)]
for i in range(N):
  tmpl=[0]
  loc=i
  for j in range(1,N+1):
    tmpl+=[tmpl[j-1]+C[loc]]
    loc=P[loc]-1
  points[i]=tmpl
repeat=K//N
left=K%N
maxlist=[]
for i in range(N):
  if points[i][N]<0:
    maxlist+=[max(points[i][1:left+1])]
  else:
    tmp=repeat*points[i][N]+max(points[i][1:left+1])
    maxlist+=[tmp]
print(max(maxlist))
  

### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
    p[i]-=1
ans=max(c)
for i in range(n):
    f=i
    r=0
    l=[]
    while True:
        f=p[f]
        l.append(c[f])
        r+=c[f]
        if f==i:
            break
    t=0
    for j in range(len(l)):
        t+=l[j]
        ret=t
        if r>0:
            e=(k-j-1)//len(l)
            ret+=r*e
        ans=max(ans,ret)
print(ans)
#D問題
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    A.extend([C]*B)
A.sort()
print(sum(A[:n]))




### FIXED CODE ###

import heapq as hq
N, M = map(int, input().split())
A = list(map(int,input().split()))
A = [(-i,1) for i in A]
hq.heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    hq.heappush(A,(-C,B))
sum_A = 0
for i in range(N):
    add_num = hq.heappop(A)
    sum_A += add_num[0]*-1
    if add_num[1] > 1:
        hq.heappush(A,(add_num[0],add_num[1]-1))
print(sum_A)
S = input()

d = {"SUN": 7, "MON":6, "TUE":5, "WED":4, "THR":3, "FRI":2, "SAT":1}
print(d[S])

### FIXED CODE ###

S = input()

d = {"SUN": 7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
print(d[S])
# A - Darker and Darker
import numpy as np

H,W = map(int,input().split())
h,w = np.arange(H,dtype=int),np.arange(W,dtype=int)
B = -1 * np.ones((H,W),dtype=int)

queue = []

for i in h:
    A = input()
    for j in w:
        if A[j]=='#':
            B[i][j] = 0
            queue.append((i,j))

while queue!=[]:
    I,J = queue.pop(0)
    for i,j in [(I-1,J),(I+1,J),(I,J-1),(I,J+1)]:
        if (i in h) and (j in w) and B[i][j]<0:
            B[i][j] = B[I][J]+1
            queue.append((i,j))

print(np.max(B))

### FIXED CODE ###

# A - Darker and Darker
from collections import deque

H,W = map(int,input().split())
B = [[-1] * W for _ in range(H)]

queue = deque([])

for i in range(H):
    A = input()
    for j in range(W):
        if A[j]=='#':
            B[i][j] = 0
            queue.append((i,j))

ans = 0

while queue:
    I,J = queue.popleft()
    for di,dj in ((-1,0),(1,0),(0,-1),(0,1)):
        i,j = I+di,J+dj
        if 0<=i<H and 0<=j<W:
            if B[i][j]<0:
                B[i][j] = B[I][J]+1
                ans = max(ans,B[i][j])
                queue.append((i,j))

print(ans)
v = []
v = str(input()).splitlines()
dif_max = -200000

for i in range(len(v)):
    v[i] = int(v[i])

len = v[0]
for i in range(2, len + 1, 1):
    for j in range(i + 1, len + 1, 1):
        dif = v[j] - v[i]
        dif_max = dif if dif_max < dif else dif_max

print("{}".format(dif_max))

### FIXED CODE ###

cnt = int(input())
dif_max = -1000000000
v_min = 1000000000

for i in range(cnt):
    buf = int(input())
    if i > 0:
        dif_max = dif_max if buf - v_min < dif_max else buf - v_min
    v_min = buf if buf < v_min else v_min
print(dif_max)
n, t = map(int, input().split())
routes = []
for _ in range(n):
  routes.append(tuple(map(int, input().split())))
print(min(route[0] for route in routes if route[1]<t))

### FIXED CODE ###

n, t = map(int, input().split())
routes = []
for _ in range(n):
  routes.append(tuple(map(int, input().split())))
try:
  print(min(route[0] for route in routes if route[1]<=t))
except:
  print("TLE")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def pow(x, n, p):
	tmp = 1
	while n:
		if n%2:
			tmp = tmp*x%mod
		x = x*x%mod
		n >>= 1
	return tmp%mod

print(pow(2, 10, mod))


lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod


H, W, A, B = MAP()

ans = 0
for n in range(B, W):
	way = C(H-A-1+n, n)*C(W-n-1+A-1, A-1)%mod
	ans = (ans+way)%mod

print(ans)







### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

lim = 2*10**6
fact = [1]*(lim+1)
for n in range(1, lim+1):
	fact[n] = n*fact[n-1]%mod

fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

H, W, A, B = MAP()

ans = 0
for n in range(B, W):
	way = C(H-A-1+n, n)*C(W-n-1+A-1, A-1)%mod
	ans = (ans+way)%mod

print(ans)
import math
n,m = list(map(int, input().split()))
s = input()
t = input()

s1 = ''
for ss in s:
    s1 += ss
    s1 += 'A'*(m-1)

t1 = ''
for tt in t:
    t1 += tt
    t1 += 'A'*(n-1)

ok = 1
for k in range(len(s1)):
    if s1[k] != 'A' and t1[k] != 'A':
        if s1[k] != t1[k]:
            ok = -1
        if ok == -1:
            break
if ok == 1:
    print(int(m * n / math.gcd(m,n)))
else:
    print('-1')

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

sdic = {}
for k in range(0, len(s)):
    sdic[k*m] = s[k]
tdic = {}
for k in range(0, len(t)):
    tdic[k*n] = t[k]
ok = 1
for skey in sdic.keys():
    try:
        if tdic[skey] != sdic[skey]:
            ok = -1
    except:
        pass
    
if ok == 1:
    print(int(m * n / gcd(m,n)))
else:
    print('-1')
n, m = [int(i) for i in input().split()]
a = [-1] + [int(input()) for _ in range(m)] + [n+1]

fib_l = [-1] * n

def fib(step):
    if step < -1:
        return 0
    if fib_l[step] != -1:
        return fib_l[step]
    if 0 <= step <= 1:
        return 1
    else:
        t = fib(step-1) + fib(step-2)
        fib_l[step] = t
        return t

ret = 1
for i in range(m+1):
    ret *= fib(a[i+1] - a[i] - 2)
print(ret % 1000000007)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
a = [-1] + [int(input()) for _ in range(m)] + [n+1]

fib_l = [-1] * (n+3)

def make_fib(n):
    fib_l[0] = fib_l[1] = 1
    for i in range(2, n):
        fib_l[i] = fib_l[i-1] + fib_l[i-2]

make_fib(n+3)
ret = 1
for i in range(m+1):
    t = a[i+1] - a[i] - 2
    if t < 0:
        ret = 0
        break
    ret *= fib_l[t]
print(ret % 1000000007)
int(input())
yo=[]
for _ in range(n-1):
  a=list(map(int,input().split()))
  yo.append(a)
  
def ans(x):
  if x==n-1:
    return 0
  else:
    t=0
    for i in range(x,n-1):
      if t<=yo[i][1]:
        t=yo[i][1]+yo[i][0]
      else:
        s=t-yo[i][1]
        if s%yo[i][2]==0:
          t=t+yo[i][0]
        else:
          mo=s%yo[i][2]
          t=t+yo[i][2]-mo+yo[i][0]
    return t
    
for j in range(n):
  print(ans(j))
        
        

### FIXED CODE ###

n=int(input())
yo=[]
for _ in range(n-1):
  a=list(map(int,input().split()))
  yo.append(a)
  
def ans(x):
  if x==n-1:
    return 0
  else:
    t=0
    for i in range(x,n-1):
      if t<=yo[i][1]:
        t=yo[i][1]+yo[i][0]
      else:
        s=t-yo[i][1]
        if s%yo[i][2]==0:
          t=t+yo[i][0]
        else:
          mo=s%yo[i][2]
          t=t+yo[i][2]-mo+yo[i][0]
    return t
    
for j in range(n):
  print(ans(j))
N=int(input())
S=str(input())
cnt=0
for i in range(N):
    if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        cnt += 1
print(cnt)

### FIXED CODE ###

N=int(input())
S=str(input())
cnt=0
for i in range(N-2):
    if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        cnt += 1
print(cnt)
s = input()

p = 700
for c in s:
  p += 100 if c == 'o'

print(p)

### FIXED CODE ###

s = input()

p = 700
for c in s:
  if c == 'o': p += 100

print(p)
n,q=map(int,input().split())
s=list(input())
#print(s)
i=0
a=[]
while i!=len(s):
    if s[i]=="C" and a1==1:

        a.append(1)
    else:
        a.append(0)
    if s[i]=="A":
        a1=1
    else:
        a1=0
    i=i+1
#print(a)
i=0
while i!=q:
    l,r=map(int,input().split())
    print(a[l:r].count(1))
    i=i+1

### FIXED CODE ###

n,q=map(int,input().split())
s=list(input())
#print(s)
i=1
a=[0]
x=0
while i!=n:
    if s[i-1]=="A":
        if s[i]=="C":
            x=x+1
    i=i+1
    a.append(x)

#print(a)
i=0
while i!=q:
  try:
    l,r=map(int,input().split())
    i=i+1
    s=a[r-1]-a[l-1]
    print(s)
  except:
      break
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
S.insert(0,[0]*W)
S.append([0]*W)
for i in range(len(S)):
    S[i].insert(0,0)
    S[i].append(0)
dx = [1,0,-1,0,1,-1,-1,1]
dy = [0,1,0,-1,1,1,-1,-1]
tmp = [[0] * W for i in range(H)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == "#":
            tmp[i-1][j-1] = "#"
            continue
        num = 0
        for k in range(len(dx)):
            if S[i+dx[k]][j+dy[k]] == "#":
                num += 1
                tmp[i-1][j-1] = str(num)
for j in range(len(tmp)):
    print("".join(tmp[j]))

### FIXED CODE ###

H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
S.insert(0,[0]*W)
S.append([0]*W)
for i in range(len(S)):
    S[i].insert(0,0)
    S[i].append(0)
dx = [1,0,-1,0,1,-1,-1,1]
dy = [0,1,0,-1,1,1,-1,-1]
tmp = [[0] * W for i in range(H)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == "#":
            tmp[i-1][j-1] = "#"
            continue
        num = 0
        for k in range(len(dx)):
            if S[i+dx[k]][j+dy[k]] == "#":
                num += 1
                tmp[i-1][j-1] = num
for j in range(len(tmp)):
    print(*tmp[j],sep = "")
N, Q = map(int, input().split())
S = str(input())
len=len(S)
for i in range(Q):
    l, r = map(int, input().split())
    slice = S[l-1:r]
    po=slice.replace("AC","")
    le=len(po)
    print((len-(r-l+1)+le)//2)

### FIXED CODE ###

N, Q = map(int, input().split())
S = str(input())
wa=[0]*N
p=0
for j in range(1,N):
    if S[j-1]=="A" and S[j]=="C":
        p+=1
        wa[j]=p
    else:
        wa[j]=wa[j-1]
for i in range(Q):
    k =input().split()
    l=int(k[0])
    r=int(k[1])
    print(wa[r-1]-wa[l-1])
from scipy.special import perm, comb
N, K = map(int, input().split())
mod = 10**9 + 7

for i in range(1, K + 1):
    print(int(((comb(K - 1, i - 1) % mod) * (comb(N - K + 1, i) % mod)) % mod))

### FIXED CODE ###

N, K = map(int, input().split())
mod = 10**9 + 7

factorial = [1]
inverse = [1]

for i in range(1, N + 2):
    factorial.append(factorial[i - 1] * i % mod)
    inverse.append(pow(factorial[i], mod - 2, mod))


def C(n, r):
    if n < r:
        return 0
    return (factorial[n] * inverse[r] * inverse[n - r]) % mod


Atable = [0] * (K + 1)
for i in range(1, K + 1):
    Atable[i] = C(K - 1, i - 1)
Btable = [0] * (K + 1)
for i in range(1, K + 1):
    Btable[i] = C(N - K + 1, i)

for i in range(1, K + 1):
    print(int(((Atable[i] % mod) * (Btable[i] % mod)) % mod))
S = int(input())
mod = 10**9 + 7

dp = [0] * (S+1)
dp[0] = 1
for i in range(1, s+1):
    for j in range((i+3)+1):
        dp[i] += dp[j]
        dp[i] %= mod

print(dp[S])


### FIXED CODE ###

S = int(input())
mod = 10**9 + 7

dp = [0] * (S+1)
dp[0] = 1
for i in range(1, S+1):
    for j in range((i-3)+1):
        dp[i] += dp[j]
        dp[i] %= mod

print(dp[S])
a, b = map(int, ' '.split(input()))
if b%a == 0:
  print(a+b)
else:
  print(b-a)

### FIXED CODE ###

a, b = map(int, input().split(' '))
if b%a == 0:
  print(a+b)
else:
  print(b-a)
n,m = list(map(int, input().split()))
s = []
c = []
for _ in range(m):
    inputs = list(map(int, input().split()))
    s.append(inputs[0])
    c.append(inputs[1])

if n == 1:
    for i in range(10):
        istr = str(i)
        flag = True #このTrueは毎回新しくTrueになる
        for j in range(m):
            if not istr[s[j]-1] == str(c[j]):
                flag = False
            if flag == True:
                print(i)
                break
else: # n!=1
    for i in range(10**(n-1),10**n):
        istr = str(i)
        flag = True
        for j in range(m):
            if not istr[s[j]-1] == str(c[j]):
                flag = False
            else: #あっていた場合何もしない
                pass
        if flag:
            print(i)
            break

### FIXED CODE ###

n = int(input())
def main(n):
  return n // 2 + n % 2
print(main(n))
A, B = int(input())
if A > B:
    print('GREATER')
elif A < B:
    print('LESS')
else:
    print('EQUAL')

### FIXED CODE ###

A, B = int(input()), int(input())
if A > B:
    print('GREATER')
elif A < B:
    print('LESS')
else:
    print('EQUAL')
import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()

n = math.ceil(N/2)
j = True

if N%2 == 0:
    for i in range(n):
    if S[i] != S[i + n]:
        j = False
else:
    for i in range(n-1):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()
if N%2 == 1:
    print('No')
    exit()

n = (N//2)
j = True


for i in range(n):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')
s = input()
k = int(input())
sl = []
if len(s) > 1:
    for i in range(len(s)-1):
        for j in range(i, len(s)+1):
            if abs(i-j) <= 5:
                s_part = s[i:j]
                if s_part not in sl and s_part != "":
                    sl.append(s_part)
    sll = sorted(sl)
    print(sll[k-1])
else:
    print(s)

### FIXED CODE ###

s = input()
l = int(input())
char = []
if len(s) == 1:
    print(s)
else:
    for i in range(len(s)):
        char.append(s[i])
    charset = set(char)
    ans = []
    for i in charset:
        for j in range(len(s)):
            if i == s[j]:
                for k in range(1, 6):
                    ans.append(s[j:j+k])
    ansset = sorted(list(set(ans)))
    print(ansset[l-1])
def addEdge(adj, u, v):
    adj[u].append(v)
def dfs(node,dp,vis,adj):
    vis[node] = True 
    for i in range(len(adj[node])):
        if not vis[adj[node][i]]: 
            dfs(adj[node][i], dp,vis,adj)
        dp[node] = max(dp[node], 1 + dp[adj[node][i]])
        
n, m = map(int, input().split())
adj = [[] for i in range(n + 1)] 
for i in range(m):
    u,v=map(int, input().split())
    addEdge(adj,u,v)
dp=[0]*(n+1)
vis=[False]*(n+1)
for i in range(1,n+1):
    if not vis[i]:
        dfs(i,dp,vis,adj)
ans=0
for i in range(1, n + 1):   
    ans = max(ans, dp[i])  
print(ans)


### FIXED CODE ###

def addEdge(adj, u, v):
    adj[u].append(v)
def dfs(node,dp,vis,adj):
    vis[node] = True 
    for i in range(len(adj[node])):
        if not vis[adj[node][i]]: 
            dfs(adj[node][i], dp,vis,adj)
        dp[node] = max(dp[node], 1 + dp[adj[node][i]])
import sys
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())
adj = [[] for i in range(n + 1)] 
for i in range(m):
    u,v=map(int, input().split())
    addEdge(adj,u,v)
dp=[0]*(n+1)
vis=[False]*(n+1)
for i in range(1,n+1):
    if not vis[i]:
        dfs(i,dp,vis,adj)
ans=0
for i in range(1, n + 1):   
    ans = max(ans, dp[i])  
print(ans)