Harryxun/stf_run huggingface dataset:
N, A, B, C, D = list(map(int, input().split()))
S = input()

# 以下indexに変更
A-=1
B-=1
C-=1
D-=1

L = [1]*N
reversed_goal = C > D
# 0を岩、1を通路とする
for i in range(N):
    if S[i] == '#':
        L[i] =  0


def search(idx, g, reversed_goal):
    L[idx] =0
    if not reversed_goal:
        if idx+1 == g or idx+2 == g:
            return True

    else:
        if idx+2 == g and L[idx+1] and L[idx+3]:
            L[idx] = 1
            L[g] = 0
            return True

        if idx+1 == g and L[idx+2]:
            L[idx] = 1
            L[g] = 0
            return True

        if idx+1 == g or idx+2 == g:
            return False


    if reversed_goal:
        if L[idx+2] and L[idx+1]:
            L[idx] = 1
            L[idx+1] = 0
            return True


    if L[idx+2]:
        L[idx] = 1
        return search(idx+2, g, reversed_goal)
    
    if L[idx+1]:
        L[idx] = 1
        return search(idx+1, g, reversed_goal)
    
    return False

def main():
    if not reversed_goal:
        r_b = search(B,D,False)
        if r_b:
            r_a = search(A,C,False)
            if r_a:
                return 'Yes'        

    else:
        r_b = search(B,D,True)
        if r_b:
            r_a = search(A,C,False)
            if r_a:
                return 'Yes'

    return 'No'

ans = main()
print(ans)

### FIXED CODE ###

if __name__ == '__main__':
    N, A, B, C, D = map(int, input().split())
    S = str(input())
 
    answer = "-1"
 
    if C < D:
       if S[A:D:].count("##") >= 1:
           answer = "No"
       else:
           answer = "Yes"
    else:
       if S[B-2:D+1:].count("...") >= 1:
           answer = "Yes"
       else:
           answer = "No"
 
    print(answer)
N, K = list(map(int, input().split()))
links = [list(map(int, input().split())) for _ in range(N-1)]

def perm(a, b):
    s = 1
    for i in range(a-b+1, a+1):
        s *= i
    return s

if N == 1:
    ans = K
else:
    perm_dict = {}
    mod = 1000000007
    d = {i: [[], True] for i in range(1, N+1)}
    for i, j in links:
        d[i][0].append(j)
        d[j][0].append(i)
    b = len(d[1][0]) - 1
    if K - 1 < b:
        ans = 0
    else:
        ans = K * perm(K - 1, b)
        d[1][1] = False
        a = K - 2
        stack = d[1][0]
        while stack:
            node = stack.pop()
            d[node][1] = False
            b = len(d[node][0]) - 1
            if a < b:
                ans = 0
                break
            if b not in perm_dict:
                perm_dict[b] = perm(a, b)
            ans *= perm_dict[b]
            for i in d[node][0]:
                if d[i][1]:
                    stack.append(i)
            
print(ans % mod)

### FIXED CODE ###

N, K = list(map(int, input().split()))
l = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    l[a].append(b)
    l[b].append(a)

deg1 = [0] * (N + 1)
deg2 = [0] * (N + 1)
history = [True] * (N + 1)
stack = [1]
ans = 1

while stack:
    node = stack.pop()
    ans *= K - deg1[node] - deg2[node]
    ans %= 1000000007
    history[node] = False
    for child in l[node]:
        if history[child]:
            deg1[child] += 1
            deg2[child] += deg1[node]
            deg1[node] += 1
            stack.append(child)
            
print(ans)
# -*- coding: utf-8 -*-

import sys


lineNumber = 0
for line in sys.stdin.readlines():
    lineNumber += 1

    # line exception
    if lineNumber == 1:
        continue
    
    # get data
    List = map(int, line.strip().split())

    # set data
    if lineNumber % 2 == 0: a = List[0]
    else                  : b = List[0]

    # sum
    if lineNumber % 2 == 1:
        c = a + b
        if c < 10**79: print str(c)
        else         : print "overflow"

### FIXED CODE ###

for i in range(int(raw_input())):
    x = int(raw_input())
    y = int(raw_input())
    s = str(x+y)
    if len(s) > 80:
        print "overflow"
    else :
        print s
cnt = 0
def s(start, end):
    global cnt
    if(start==len(S)-1):
        return 
    numS = int(S[start:end+1])
    if(numS%2019==0 and numS!=0):
        print(numS)
        cnt += 1
    if(end==len(S)-1):
        end = start+2
        s(start+1, end)
        return
    s(start, end+1)

if __name__ == '__main__':
    S = input()
    s(0, 1)
    print(cnt)

### FIXED CODE ###

S = list(map(int, list(input())))[::-1]
N = len(S)
CNT = [0]*2019
CNT[0] = 1
num = 0
d = 0
for i in range(N):
    num += S[i]*pow(10, d, 2019)
    num %= 2019
    CNT[num] += 1
    d += 1
ans = 0 
for cnt in CNT:
    ans += (cnt*(cnt - 1)) // 2
print(ans)
import math
A,B = map(int,input().split())
print(int(A*B/math.gcd(A,B)))

### FIXED CODE ###

import fractions
A,B = map(int,input().split())
print(int(A*B/fractions.gcd(A,B)))
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
a = sorted(list(a))
ma = max(a)

div = defaultdict(bool)
count = 0
for i in range(n):
    b = a[i]
    if div[b]:
        count += 1
    else:
        for j in range(1,ma//b+1):
            div[j*b] = True
        if(i<n and a[i] == a[i+1]):
            count += 1

if(n == 1):
    print(0)
else:
    print(n-count)

### FIXED CODE ###

from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
a = sorted(list(a))
ma = max(a)

div = defaultdict(bool)
count = 0
for i in range(n):
    b = a[i]
    if div[b]:
        count += 1
    else:
        for j in range(1,ma//b+1):
            div[j*b] = True
        if(i+1<n and a[i] == a[i+1]):
            count += 1

print(n-count)
-*- coding: utf-8 -*-
print(re.sub('[a-z]', 'x', input()))

### FIXED CODE ###

# -*- coding: utf-8 -*-
import re
s = input()
print(re.sub('[a-z]', 'x', s))
N = int(input())
 A = [int(x) for x in input().split()]
for i in A:
   	if A.count(i) >= 2:
   	   print('YES')
       return
print('NO')

### FIXED CODE ###

S,T = input().split()
A,B = input().split()
U = input()
if U == S:
    A = int(A)-1
else:
    B = int(B)-1
print(str(A)+' '+str(B))
s = input()
k = int(input())
for i in range(k):
    if s[i]!='1':
        print(s[i])
        exit()
print(s[k])

### FIXED CODE ###

s = input()
k = int(input())
for i in range(k):
    if s[i]!='1':
        print(s[i])
        exit()
print(s[k-1])
import numpy as np

def abc069_d():
    H, W = map(int, input().split())
    _ = int(input())
    A = list(map(int, input().split()))

    # いったん1次元に並べる
    flat = []
    for i, a in enumerate(A):
        flat += [i+1] * a

    # 2次元に変形して、1行飛ばしで反転(折り返して往復すればつながる)
    grid = np.array(flat, dtype=int).reshape((H, W))
    for i in range(H):
        if i % 2 == 0:
            print(*grid[i], sep=' ')
        else:
            print(*np.flip(grid[i]), sep=' ')

abc069_d()

### FIXED CODE ###

import numpy as np

def abc069_d():
    H, W = map(int, input().split())
    _ = int(input())
    A = list(map(int, input().split()))

    # いったん1次元に並べる
    flat = []
    for i, a in enumerate(A):
        flat += [i+1] * a

    # 2次元に変形して、1行飛ばしで反転(折り返して往復すればつながる)
    grid = np.array(flat, dtype=int).reshape((H, W))
    for i in range(H):
        if i % 2 == 0:
            print(*grid[i], sep=' ')
        else:
            print(*grid[i, ::-1], sep=' ')

abc069_d()
n=input()
A=input()
B=input()
C=input()

As=map(int,A.split(' '))
Bs=map(int,B.split(' '))
Cs=map(int,C.split(' '))
total=0
for i in range(0,n):
    if A[i]-A[i-1]==1 and i!=0:
        total=total+Cs[A[i]]
    else:
        total=total+Bs[A[i]]
print(total)

### FIXED CODE ###

n=int(input())
A=input()
B=input()
C=input()

As=list(map(int,A.split(' ')))
Bs=list(map(int,B.split(' ')))
Cs=list(map(int,C.split(' ')))
total=0
for i in range(0,n):
    if As[i]-As[i-1]==1 and i!=0:
        total=total+Cs[As[i]-2]
    total=total+Bs[As[i]-1]
print(total)
n = int(input())
a = list(map(int, input().split()))

d = [[0]*n for _ in range(n)]

for i in range(n):
    b = list(a)
    b[i] = 0
    for j in range(n):        
        d[i][b[j]] = d[i][b[j]]+1
    
for i in range(n):
    c = 0
    for j in range(n):
        c = c + d[i][j]*(d[i][j]-1)//2
    print(c)

### FIXED CODE ###

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

c = [0]*n

for i in range(n):
    c[a[i]-1] = c[a[i]-1] + 1
    
total = 0
for x in c:
    total = total + x*(x-1)//2

for i in range(n):
    print(total - c[a[i]-1] + 1)
N, T = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    i += 1
print(A,B)
if T >= min(B):
    for j in range(len(A)-1):
        if B[j] > T:
            A.pop(j)
            B.pop(j)
        else:
            pass
    print(min(A))
else:
    print("TLE")

### FIXED CODE ###

N, T = map(int, input().split())
ans = "TLE"
x = 1001
for i in range(N):
    c, t = map(int, input().split())
    if c <= x and t <= T:
        x = c
        ans = c
    else:
        pass
print(ans)
#072B
s=list(input())
data=s[0]
i=1
while i*2<=len(s):
    data=data+s[i*2]
    i=i+1
print(data)

### FIXED CODE ###

#072B
s=list(input())
data=s[0]
i=1
while i*2<len(s):
    data=data+s[i*2]
    i=i+1
print(data)
X,Y,Z,K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = reversed(sorted(A))
B = reversed(sorted(B))
C = reversed(sorted(C))
abc_list=[]

for i in A:
    for j in B:
        for k in C:
            if i * j * k <= K:
                abc_list.append(i+j+k)
            else:
                break

abc_list = reversed(sorted(abc_list))

for i in range(K):
    print(abc_list[i])

### FIXED CODE ###


X,Y,Z,K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = list(reversed(sorted(A)))
B = list(reversed(sorted(B)))
C = list(reversed(sorted(C)))
abc_list=[]

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1) * (j+1) * (k+1) <= K:
                abc_list.append(A[i] + B[j] +C[k])
            else:
                break

abc_list = list(reversed(sorted(abc_list)))

for i in range(K):
    print(abc_list[i])
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

sum = 0
for i in skill:
    sum = sum + i

if sum >= H:
    print("Yes")
else:
    print("No")
s = list(int(input()))
ans = sum(s)
print(ans)

### FIXED CODE ###

s = list(input())
for i in range(3):
    s[i] = int(s[i])
print(sum(s))
x = int(input())
c = [i for i in range(1,x+1)]
l = map(int,input().split())
count = 0
for i,j in zip(c,l):
	if i% 2== 1 and j%2 == 1:
		count+=1a
print(count)

### FIXED CODE ###

x = int(input())
c = [i for i in range(1,x+1)]
l = map(int,input().split())
count = 0
for i,j in zip(c,l):
	if i% 2== 1 and j%2 == 1:
		count+=1
print(count)
import math

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

adivc = A//C
if A%C != 0:
    adivc = A//C + 1
bdivc = B//C
countC = bdivc - adivc + 1

adivd = A//D
if A%D != 0:
    adivd = A//D + 1
bdivd = B//D
countD = bdivd - adivd + 1

lcm = (int)(C * (D / math.gcd(C, D)))
adivlcm = A // lcm
if A%lcm != 0:
    adivlcm = A // lcm + 1
bdivlcm = B // lcm
countlcm = bdivlcm - adivlcm + 1

print(B-A+1-(countC+countD-countlcm))

### FIXED CODE ###

from fractions import gcd

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

adivc = A//C
if A%C != 0:
    adivc = A//C + 1
bdivc = B//C
countC = bdivc - adivc + 1

adivd = A//D
if A%D != 0:
    adivd = A//D + 1
bdivd = B//D
countD = bdivd - adivd + 1

lcm = (int)(C * D / gcd(C, D))
adivlcm = A // lcm
if A%lcm != 0:
    adivlcm = A // lcm + 1
bdivlcm = B // lcm
countlcm = bdivlcm - adivlcm + 1

print(B-A+1-(countC+countD-countlcm))
r,g,b = map(int , input()split())

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

### FIXED CODE ###

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

if (10*g + b) %4 == 0:
  print("YES")
else:
  print("NO")
#from fractions import gcd
#A,B = map(int, input().split())
#print(A*B//gcd(A,B))
def gcd(a,b):
    if(a<b):
         b,a=a,b
    if(b==0):
        return a
    r = a%b
    if(r!=0) :
        a,b,r=b,r,b%r
        return gcd(b,r)
    else:
        return b

A,B = map(int, input().split())
print(A*B//gcd(A,B))

### FIXED CODE ###

A = int(input())
B = int(input())

print(6-A-B)
a,b=input().split()
A=int(a)
B=float(b)
print(A*B*100)/100

### FIXED CODE ###

from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print(floor(a * b))
n = int(input())
a_list = list(map(int, input().split()))

co = a_list.copy()
if 0 in co:
    co.remove(0)
co.sort()


if not len(co) % 2 == 0:
    print(0)
    quit()

for index in range(len(a_list))[::2]:
    print(co[index])
    print(co[index+1])
    if not co[index] == co[index + 1]:
        print(0)
        quit()




print(int(pow(2, floor(n / 2))) % (pow(10,9) + 7))

### FIXED CODE ###

from math import factorial, floor
n = int(input())
a_list = list(map(int, input().split()))

co = a_list.copy()
if 0 in co:
    co.remove(0)
co.sort()


if not len(co) % 2 == 0:
    print(0)
    quit()

for index in range(len(a_list))[:-1:2]:
    if not co[index] == co[index + 1]:
        print(0)
        quit()


print(int(pow(2, floor(n / 2))) % (pow(10,9) + 7))
N = input()
if N % 2 == 0:
  print(N/2)
else:
  print(N//2 ＋1）
        

### FIXED CODE ###

N = input()
N = int(N)
if N%2==0:
  a = N//2
  print(a)
else:
  b = N//2 +1
  print(b)
N = input()
A = list(map(int,input().split()))
#２の倍数かどうかを調べる関数　引数:4→True,5→False

def isAllEVEN(A):
    return (not (False in (list(map(lambda x:x%2==0,A)))))

i = 0
while(isAllEVEN(A)):
A = list(map(lambda x:x/2,A))
    i++;
print(i)  
       

### FIXED CODE ###

def choise(s):
  return len(list(filter(lambda x:x=='1',s)))

if __name__ == "__main__":
    i1 = input()
    print(choise(i1))
N = int(input())
arr = list(map(int, input().split()))
for i in range(min(N,25)):
    if arr[i] > 2**i:
        print(-1)
        exit()
sum_arr = [0]*N
sum_arr[0] = arr[-1]
for i in range(1,N):
    sum_arr[i] = sum_arr[i-1]+arr[N-i]
sum_arr = sum_arr[::-1]
ans = [0]*(N+1)
ans[0] = 1
for i in range(1,N+1):
    if (ans[i-1]-arr[i-1])*2 <= sum_arr[i-1]:
        tmp = (ans[i-1]-arr[i-1])*2
    else:
        tmp = sum_arr[i-1]
    ans[i] = tmp
print(sum(ans))

### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
if N == 0:
    if arr[0] == 1:
        print(1)
    else:
        print(-1)
    exit()
else:
    if arr[0] != 0:
        print(-1)
        exit()
sum_arr = [0]*N
sum_arr[0] = arr[-1]
for i in range(1,N):
    sum_arr[i] = sum_arr[i-1]+arr[N-i]
sum_arr = sum_arr[::-1]
ans = [0]*(N+1)
ans[0] = 1
for i in range(1,N+1):
    if ans[i-1]-arr[i-1] < 0:
        print(-1)
        exit()
    tmp = min((ans[i-1]-arr[i-1])*2,sum_arr[i-1])
    ans[i] = tmp
for i in range(min(25,N+1)):
    if ans[i] > 2**i:
        print(-1)
        exit()
if ans[N] != arr[-1]:
    print(-1)
    exit()
print(sum(ans))
N = int(input())

if N % 2 = 0:
    print 'N'
else:
    print 'N + 1'

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
    print(N // 2)
else:
    print(N // 2 + 1)
from operator import mul
from functools import reduce


def comb(n, r):
    r = min(n-r,r)
    if r == 0:
      return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

  
n, k = map(int, input().split())
for i in range(1, k+1):
	dis = k - i
	cnt = comb(n-k+1, i)
	if i > 1:
		cnt *= comb(k-1, i-1)
	print(cnt%(10**9+7))


### FIXED CODE ###

from operator import mul
from functools import reduce


def comb(n, r):
    r = min(n-r,r)
    if r == 0:
      return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

  
n, k = map(int, input().split())
for i in range(1, k+1):
	if n-k+1 >= i:
		cnt = comb(n-k+1, i) * comb(k-1, i-1)
		print(cnt%(10**9+7))
	else:
		print(0)
s = int(input()).split()

a1 = s[0] * s[2]
a2 = s[0] * s[3]
a3 = s[1] * s[2]
a4 = s[1] * s[3]

list = (a1,a2,a3,a4)

print(max(list))

### FIXED CODE ###

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

a1 = A * C
a2 = A * D
a3 = B * C
a4 = B * D

list = (a1,a2,a3,a4)

print(max(list))
N, M = map(int, input().split())
dp = [int(input()) for i in range(N+1)]
for i in range(M):
    A = int(input())
    dp[A] = -1
dp[0] = 1
for j in range(2, N + 1):
    if dp[j] == -1:
        dp[j] = 0
        continue
    dp[i] = dp[i-2] + dp[i-1]

print(dp[N] % 1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
dp = [0 for i in range(N+1)]
for i in range(M):
    A = int(input())
    dp[A] = -1
dp[0] = 1
if dp[1] != -1:
    dp[1] = 1
else:
    dp[1] = 0
for j in range(2, N + 1):
    if dp[j] == -1:
        dp[j] = 0
        continue
    dp[j] = dp[j-2] + dp[j-1]

print(dp[N] % 1000000007)
N, W = map(int, input().split())
wt, vt = [], []
for _ in range(N):
    w, v = map(int, input().split())
    wt.append(w)
    vt.append(v)

dp = [[0] * (W + 5) for _ in range(100)]

for i in range(N):
    for j in range(W + 1):
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
        if 0 <= j - wt[i]:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - wt[i]] + vt[i])
# print(dp)
print(dp[N][W])

### FIXED CODE ###

N, W = map(int, input().split())
wt, vt = [], []
for _ in range(N):
    w, v = map(int, input().split())
    wt.append(w)
    vt.append(v)

dp = [[0] * (W + 5) for _ in range(105)]

for i in range(N):
    for j in range(W + 1):
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
        if 0 <= j - wt[i]:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - wt[i]] + vt[i])
# print(dp)
print(dp[N][W])
n = int(input())

cnt = [0] * 1001

for i in range(1, 100):
	for j in range(1, 100):
		for k in range(1, 100):
			x = i*i + j*j + k*k + i*j + j*k + i*k
			if(x <= 1000):
				cnt[x]+=1

for i in range(1, n+1):
	print(cnt[i])

### FIXED CODE ###

n = int(input())

cnt = [0] * 10001

for i in range(1, 100):
	for j in range(1, 100):
		for k in range(1, 100):
			x = i*i + j*j + k*k + i*j + j*k + i*k
			if(x <= 10000):
				cnt[x]+=1

for i in range(1, n+1):
	print(cnt[i])
g=[]
a, b, c, d, e, f = map(int,input().split())
for i in a, b, c, d, e, f:
    g.append(i)
h=g.index(0)
print(h+1)

### FIXED CODE ###

g=[]
a, b, c, d, e = map(int,input().split())
for i in a, b, c, d, e:
    g.append(i)
print(g.index(0)+1)
from sys import stdin
from functools import reduce
from operator import add, mul

from functools import lru_cache
@lru_cache(maxsize=None)  # メモ化したい関数の前につける
def fib(n):  # n 番目のフィボナッチ数を求める関数
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n - 2) + fib(n - 1)


nm = [int(i) for i in stdin.readline().rstrip().split(" ")]
a = []
for i in range(nm[1]):
    a.append(int(stdin.readline().rstrip()))
result =[]
result.append(fib(a[0]))
for i in range(nm[1]-1):
    result.append(fib(a[i+1] - a[i] - 1))
result.append(fib(nm[0] - a[nm[1]-1]))
print(reduce(mul, result) % 1000000007)

### FIXED CODE ###

from sys import stdin

abc = [int(i) for i in stdin.readline().rstrip().split(" ")]
s = sum(abc) 
m = max(abc)
print(s-m)
w,h,x,y,r = map(int,raw_input().split())
 if w-r > x and h-r > y and x > 0 and y > 0:
    print "Yes"
else:
    print "No"

### FIXED CODE ###

w,h,x,y,r = map(int,raw_input().split())
if w-r >= x and h-r >= y and x-r >= 0 and y-r >= 0:
    print "Yes"
else:
    print "No"
from bisect import bisect_left
N = int(input())
A = list(int(input()) for _ in range(N))
S = sorted(S)
A = [bisect_left(S,a) for a in A]
print((sum((i-j)%2 for i,j in enumerate(A))+1)//2)

### FIXED CODE ###

from bisect import bisect_left
N = int(input())
A = list(int(input()) for _ in range(N))
S = sorted(A)
A = [bisect_left(S,a) for a in A]
print((sum((i-j)%2 for i,j in enumerate(A))+1)//2)
N = int(input())
A = [0] * (10**4)
import math
import numpy
tmp=0
for i in range(1,int(math.sqrt(N))):
    for j in range(1,int(math.sqrt(N))):
        for k in range(1,int(math.sqrt(N))):
            tmp=(i+j+k)**2-(i*j+j*k+i*k)
            if tmp<=10**4:
                A[tmp]+=1
for p in A[1:N+1]:
    print(p)

### FIXED CODE ###

N = int(input())
A = [0] * (10**4+1)
import math
import numpy
tmp=0
for i in range(1,int(math.sqrt(N))):
    for j in range(1,int(math.sqrt(N))):
        for k in range(1,int(math.sqrt(N))):
            tmp=(i+j+k)**2-(i*j+j*k+i*k)
            if tmp<=10**4:
                A[tmp]+=1
for p in A[1:N+1]:
    print(p)
n=int(input())
if n[1]!='0':
  print(100)
else:
  print(0)

### FIXED CODE ###

from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	n=int(input())
	change = n%1000
	if change:
		print(1000-change)
	else:
		print(0)
		
	
main()

'''
if __name__ == '__main__':
    main()
'''
#! env/bin/local python3

s, t = input().split()
a, b = map(int, input().split())
u = int(input())

balls = {
    s: a,
    t: b
}

balls[u] -= 1

print(f'{balls[s]} {balls[t]}')


### FIXED CODE ###

#! env/bin/local python3

s, t = input().split()
a, b = map(int, input().split())
u = input()

balls = {
    s: a,
    t: b
}

balls[u] -= 1

print('{} {}'.format(balls[s], balls[t]))
um_list = list(input().split())
a = int(num_list[0])
b = int(float(num_list[1])*100)

print((a*b)//100)

### FIXED CODE ###

from decimal import Decimal
num_list = list(input().split())
a = Decimal(num_list[0])
b = Decimal(num_list[1])

print(int(a*b))
def cmb(n, r, mod):

    if ( r<0 or r>n ):
        return 0


    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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








n, k = map(int, input().split())
a=list(map(int, input().split()))
a.sort()
mod=10**9+7
min=0
max=0
for i in range(n-k+1):
    x=cmb(n-i-1,k-1,mod)
    min+=a[i]*x
    max+=a[n-1-i]*x
    min%=mod
    max%=mod

ans=max-min


print(ans%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r=min(r,n-r)

    return g1[n] * g2[r] * g2[n - r] % mod


mod = 10 ** 9 + 7  # 出力の制限
N = 10 ** 5
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

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

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
mod =10**9+7
mi = 0
ma = 0
for i in range(n - k + 1):
    x = cmb(n - i - 1, k - 1, mod)
    mi += a[i] * x
    ma += a[n - 1 - i] * x
    mi %= mod
    ma %= mod

ans = ma - mi

print(ans % mod)
n=input()
if n==A:
  print('T')
elif n==T:
  print('A')
elif n=C:
  print('G')
else:
  print('C')

### FIXED CODE ###

n=input()
if n=='A':
    print('T')
elif n=='T':
    print('A')
elif n=='C':
    print('G')
else:
    print('C')
n = int(input())
h = [int(i) for i in input().split()]
for j in range(n):
  if h[j] - h[j+1] > 1:
    print("No")
    exit()
  else:
    h[j] = h[j] -1
  if h[j] > h[j+1]:
    print("No")
    exit()
print("Yes")


### FIXED CODE ###

n = int(input())
h = [int(i) for i in input().split()]
for j in range(n-1):
  if h[j] - h[j+1] > 1:
    print("No")
    exit()
  elif h[j] == h[j+1] + 1:
    h[j+1] += 1
print("Yes")