peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())

if n%2==1:
    print(0)
    exit()

cnt=0
n//=2
fact=1
while n>=5**fact:
    cnt+=n//(5**fact)
    fact+=1
print(cnt)
# Judge status: Accepted
import math
n=int(input())
a=0
a=math.floor(n/15)
print(n*800-a*200)
# Judge status: Accepted
l = list(range(2,14))+[1]
a,b = map(int,input().split())
a,b = l.index(a),l.index(b)
print("Draw" if a == b else "Alice" if a > b else "Bob")
# Judge status: Accepted
a =input()

b = a[0:4]+a[5:7]+a[8:10]

if int(b) <=20190430:
    print("Heisei")

else:
    print("TBD")
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

if N%1000==0:
    print(0)
else:
    print(1000-(N%1000))
# Judge status: Accepted
from fractions import gcd

A, B, C, D = map(int, input().split())
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print(y - x)
# Judge status: Wrong Answer
N = int(input())
*A, = map(int, input().split())

dp = [0]*(N+1)
dp[0] = 1000

for i in range(1, N+1):
    for j in range(1, i):
        dp[i] = max(dp[i], dp[i-1], (dp[j]//A[j-1])*A[i-1] + (dp[j]%A[j-1]))

print(dp[-1])
# Judge status: Wrong Answer
a,b = map(int,input().split())
if abs(a-b)%2==0:
  print(abs(abs(a-b)//2-a))
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
n = int(input())
ls_a = list(map(int, input().split()))
ls_b = list(map(int, input().split()))

ans = 0
res = 0

for i in range(n):
	ans += min(ls_a[i], res + ls_b[i])
	if res >= ls_a[i]:
		res = ls_b[i]
	else:
		res = max(res + ls_b[i] - ls_a[i], 0)

if res >= ls_a[n]:
	print(ans + ls_a[n])
elif 0 <= res < ls_a[n]:
	print(ans + res)
else:
	print(ans)
# Judge status: Accepted
N = int(input())
C = [100+i for i in range(6)]
T = [float('inf')]*(N+1)
T[0] = 0

for i in range(6):
    for j in range(C[i], N+1):
        T[j] = min(T[j], T[j - C[i]] + 1)

if T[N] != float('inf'):
    print(1)
else:
    print(0)
# Judge status: Accepted
import sys, collections
n = int(input())
a = collections.Counter(sys.stdin.readline().split())
ans = 0
for i in a:
    if int(i) > a[i]:
        ans += a[i]
    elif int(i) < a[i]:
        ans += a[i] - int(i)
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
jobs = sorted([list(map(int, input().split())) for i in range(N)], reverse=True)

from heapq import *
q = []
heapify(q)
ans = 0
for i in range(1, M+1):
    while jobs and jobs[-1][0] <= i:
        heappush(q, -1*jobs.pop()[1])
    if q:
        ans += -1 * heappop(q)
print(ans)
# Judge status: Wrong Answer
import numpy as np
S = list(input())
print(np.sum([1 for a, b in zip(S[:int(np.floor(len(S)/2))], list(reversed(S[int(np.ceil(len(S)/2)):]))) if not a == b]))
# Judge status: Wrong Answer
a=input()

print('A' if(a.isupper) else 'a')
# Judge status: Accepted
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
        ans = max(ans, j - i + 1)
print(ans)
# Judge status: Accepted
MOD = 7+1000000000

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

def solve():
  X,Y = map(int,input().split())
  if (X+Y)%3:
    return 0
  if (2*X-Y)%3:
    return 0
  m = (2*X-Y)//3
  n = X - 2*m
  if m < 0 or n < 0:
    return 0
  return (combination(m+n,m))

print(solve())
# Judge status: Accepted
N,M=map(int,input().split())
abs_NM=abs(N-M)
if abs_NM>1:
    print(0)
    exit()

p=10**9+7
min_=min(N,M)
max_=max(N,M)
ans=1
for i in range(1,min_+1):
    ans=(ans*i)%p
    ans=(ans*i)%p

if abs_NM==1:
    ans=(ans*max_)%p
else:
    ans=(ans*2)%p

print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())
print(M//2 if 2*M < M else N + (M-2*N)//4)
# Judge status: Accepted
import math as math
n = int(input())
li = [1]
nroot = int(math.sqrt(n))
for i in range(2,nroot+1):
    for j in range(2,100):
        if i**j <= n:
            li.append(i**j)
        else:
            break
print(max(li))
# Judge status: Wrong Answer
N = int(input())
W = [input() for _ in range(N)]

a = []
pre = W[0]
flag = False
for wi in W[1:]:
    if wi in a or pre[-1] != wi[0]:
        flag = True
        break
    pre = wi
    a.append(wi)
        
if flag:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
a = input()

print(chr(ord('a') + 1))
# Judge status: Accepted
k, a, b = list(map(int, input().split()))

ans = 1
if b >= a+3:
    if k >= a+1:
        ans += b-1

        ans += (b-a)*((k-(a+1))//2)
        ans += (k-(a+1)) % 2
    else:
        ans += k
else:
    ans += k

print(ans)
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())
import collections

c = collections.Counter(A)

ans=0
for k,v in c.items():
    if k == v: continue
    if k < v: # kに対して要素数が多いので取り除く
        ans+=v-k
    if v < k: # kに対して要素数が少ないので、すべて取り除く
        ans+=v
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
sc_ls = [list(map(int, input().split())) for _ in range(m)]

for num in range(10**n):
    if len(str(num)) != n:
        continue

    for s, c in sc_ls:
        if str(num)[s-1] != str(c):
            break
    else:
        print(num)
        break
else:
    print(-1)
# Judge status: Wrong Answer
N = int(input())
h = list(map(int, input().split()))

dp = [1e7]*N
dp[0] = h[0]
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])
# Judge status: Accepted
n,m,k = list(map(int, input().split()))
for i in range(n+1):
    for j in range(m+1):
        if i*m+j*n-2*i*j==k:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
#graph implementation
import math
n,m=map(int,input().split())
ans=['l']*n
for i in range(m):
    s,c=map(int,input().split())
    if ans[s-1]=='l':
      ans[s-1]=c
    else:
        if ans[s-1]!=c:
            print(-1)
            exit(0)
if ans[0]=='l' and n>1:
    ans[0]=1
for i in range(n):
    if ans[i]=='l':
        ans[i]=0
if ans[0]==0 and n>1:
    print(-1)
else:
    for i in ans:
        print(i,end="")
print()
# Judge status: Accepted
n = int(input())
s = []
for _ in range(n):
    S = list(input())
    S.sort()
    s.append(S)
#print(s)
a_z = "abcdefghijklmnopqrstuvwxyz"
ans = []
for i in range(26):
    minimum = 1000000
    for j in range(n):
        kosuu = s[j].count(a_z[i])
        minimum = min(minimum, kosuu)
        if minimum == 0:
            break
    else:
        for _ in range(minimum):
            ans.append(a_z[i])
print("".join(ans))
# Judge status: Accepted
N = int(input())
A = int(input())
print('Yes' if A >= (N%500) else ('No'))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=sum(a)
for i in range(n):
    if a[i]+a[i+1]>=b[i]:
        if a[i]>=b[i]:
            a[i]-=b[i]
        else:
            a[i+1]=a[i+1]-b[i]+a[i]
            a[i]=0
    else:
        a[i]=0
        a[i+1]=0
print(ans-sum(a))
# Judge status: Accepted
input_a = input().split()
a = int(input_a[0])
v = int(input_a[1])
input_b = input().split()
b = int(input_b[0])
w = int(input_b[1])
t = int(input())

distance = abs(a - b)
relative_velocity = v - w

if relative_velocity <= 0:
    print("NO")
elif  distance / relative_velocity > t:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
N,K=input().split()
n,k=int(N),int(K)

for i in range(0,1000000):
   
    if n-k**i>1:
        print(i)
        break
    if n==k**i-1:
        print(i-1)
        break
# Judge status: Accepted
A=list(map(int,input().split()))
B=list(map(int,input().split()))
T=int(input()) 

if abs(A[0]-B[0])+B[1]*T>A[1]*T:
       print("NO")
else:
       print("YES")
# Judge status: Accepted
a,b,t=map(int, input().split())

ans=(t+0.5)//a*b
print(int(ans))
# Judge status: Wrong Answer
s=input()
ans=False
for i in range(len(s)):
  if s[i]=='9':
    ans=False

if ans:
  print('Yes')
else :
    print('No')
# Judge status: Accepted
n,k=map(int,input().split())
ans=n
nex=n
w=n//k
#print(w)
nex=n-k*w
if ans>nex:
  ans=nex
#print(nex,ans)
while (nex<=k and nex>(k-nex)) and ans!=0:
  nex=k-nex
  if nex<ans:
    ans=nex
  if ans==0:
    break
print(ans)
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

def main():
    N = I()
    ARM = []
    for i in range(N):
        X,L = LI()
        ARM.append([X-L,X+L])
    ARM.sort(key=lambda x: x[0])
    ARM.sort(key=lambda x: x[1])

    cur = -1 * (10**10)
    ans = 0

    for i in range(N):
        if cur <= ARM[i][0]:
            ans += 1
            cur = ARM[i][1]

    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
k = int(input())
checked = [False] * k

surplus = 0
ans = 1
while 1:
    surplus = ((surplus * 10) + 7) % k
    if checked[surplus]:
        print(-1)
        exit()
    if surplus == 0:
        break
    checked[surplus] = True
    ans += 1

print(ans)
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
ans=[a*c,a*d,b*c,b*d]
if ((a<=0 and b>=0) and d<=0) or ((c>=0 and d>=0) and b<=0):
    print(0)
else:
    print(max(ans))
# Judge status: Wrong Answer
K = int(input())

print((K+1)>>1 * K>>1)
# Judge status: Accepted
N, M = map(int, input().split())

print("Yes" if N == M else "No")
# Judge status: Accepted
w, a, b = list(map(int, input().split()))
if abs(a - b) <= w:
  print(0)
else:
  print(abs(a -b) - w)
# Judge status: Wrong Answer
A = int(input())
B = int(input())

list = [1,2,3]

list.remove(A)
list.remove(B)

print(list)
# Judge status: Wrong Answer
import math
a,b,c=list(map(int, input().split())) 
kotae1=math.floor(b/c)
kotae2=math.floor(a/c)
ans=kotae1-kotae2
if(a==c):
    ans+=1
print(ans)
# Judge status: Accepted

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

A = []
for i in range(n):
    A.append(input())

B = []
for i in range(m):
    B.append(input())

for i in range(n-m+1):
    for j in range(n-m+1):
        f = True
        for k in range(m):
            for l in range(m):
                if A[i+k][j+l] != B[k][l]:
                    f = False
        if f:
            print("Yes")
            exit()

print("No")
# Judge status: Wrong Answer
K, N = [int(n) for n in input().split()]
A = [0]
A += [int(n) for n in input().split()]
A += [K]
dx = []
for i in range(N+1):
    dx.append(A[i+1] - A[i])
m = max(dx)
print(K-m if dx.index(m) != 0 else K-dx[-1]-dx[0])
# Judge status: Accepted
x,y=map(int,input().split())
ans=1
tmp=x
while 1:
  if tmp*2<=y:
    ans+=1
    tmp*=2
  else:
    print(ans)
    exit()
# Judge status: Accepted
S = input()
NS = [0]*len(S)
for i in range(len(S)):
    NS[i] = S[i]

#print(NS)
#print(len(set(NS)))

if len(set(NS)) == 1:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))
MAXINT = 10**8
dp = [MAXINT for _ in range(n)]
dp[0] = 0

def chmin(a, b):
    if (a > b):
        a = b
        return True
    return False

for i in range(n-1):
    for j in range(1, k):
        if i+j>=n:
            break
        if dp[i+j] > dp[i] + abs(h[i] - h[i+j]):
            dp[i+j] = dp[i] + abs(h[i] - h[i+j])

print(dp[n-1])
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

def ceil(x,y):
  return (x-1)//y+1


n,h = map(int,input().split())
A = [];B = []
for i in range(n):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)
MA = max(A)
B.sort(reverse = True)
for i in range(n):
  if not (B[i] >= MA and h > 0):break
  count += 1
  h -= B[i]
count += (h-1+MA)//MA
print(count)
# Judge status: Accepted
a,b,x,y = map(int, input().split())

xl = list(map(int, input().split()))
yl = list(map(int, input().split()))

xx = max(xl)
xx = max(xx,x)
yy = min(yl)
yy = min(yy,y)

if xx<yy:
    print("No War")

else:
    print("War")
# Judge status: Accepted
n = int(input())
key = [0]*(n+1)
key[0] = 2
key[1] = 1
for i in range(2, n+1):
    key[i] = key[i-1]+key[i-2]
print(key[n])
# Judge status: Accepted
X = int(input())

print((X//500)*1000 + X%500//5*5)
# Judge status: Accepted
a, b, c = input().split()
print(a[0] + b[0] + c[0])
# Judge status: Accepted
a, b = map(int, input().split())

if a == 1:
    a = 14
if b == 1:
    b = 14

if a > b:
    print("Alice")
elif a < b:
    print("Bob")
else:
    print("Draw")
# Judge status: Wrong Answer
a=input()
b=ord(a)
if(b>=65)and(b<=89):
    print('A')
#if (b>=97)and(b<=122):
else:
    print('a')
# Judge status: Accepted
s = input()
set_s = set(s)

moji = [chr(i) for i in range(97,97+26)]
for i in range(len(moji)):
    if not(moji[i] in set_s):
        print(moji[i])
        quit()
print("None")
# Judge status: Accepted
list=input().split()
if list[0]==list[1]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import math
x, y = map(int, input().split())
print(int(math.log2(y//x+0.0001) + 1))
# Judge status: Wrong Answer
a=str(input())
if "a".isupper()==True:
    print("A")
else:
    print("a")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
result=[]       
for i in range(0,102):
  count=0
  for j in range(n):
    count+=(a[j]-i)**2
  result.append(count)
print(min(result))
# Judge status: Accepted
def main():
    n = int(input())
    l = tuple([int(t)for t in input().split()])

    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                lst = sorted([l[i],l[j],l[k]])
                if len(set(lst))==3:
                    if lst[2] < lst[0]+lst[1]:
                        ans+=1
    
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
info = []
for i in range(n):
    s, p = input().split()
    info.append([s, 100 - int(p), i+1])
info.sort()
for i in range(n):
    print(info[i][2])
# print(info)
# Judge status: Accepted
N,M = map(int,input().split())
a,b = list(),list()
res = list()
for i in range(N):
  t = input().split()
  a.append(int(t[0]))
  b.append(int(t[1]))
  res.append([0,0])
for n in range(M):
  c,d = map(int,input().split())
  for i in range(N):
    if n == 0:
      res[i][0] = abs(a[i]-c) + abs(b[i]-d) 
    elif res[i][0] > abs(a[i]-c) + abs(b[i]-d):
      res[i][0] = abs(a[i]-c) + abs(b[i]-d)
      res[i][1] = n
for m in range(N):
  print(res[m][1] + 1)
# Judge status: Wrong Answer
import numpy as np

n = int(input())

#print ((n*(n-1)*10**(n-2)) % (1E9+7))

div=1000000007
mod1=n % div
mod2=(n-1) % div

loop=(n-2)//10
amari=(n-2)%10
mod3=1
for i in range(0,loop):
  mod3=(mod3*(10000000000 % div) ) % div
mod3=mod3*(10**amari % div)

print (loop, amari)
print((((mod1*mod2) % div)*mod3)%div)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
ret = 0

for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
        if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
          ret += 1

print(ret)
# Judge status: Wrong Answer
a,b,n = map(int,input().split())
ans = 0

# for i in range(n+1,n-2*a,-1):
for i in range(2*a):
    ans = max(ans,int((a*i)/b) - a*int(i/b))

print(ans)
# Judge status: Accepted
a, b, m = map(int,input().split())

a_i = list(map(int,input().split()))
b_j = list(map(int,input().split()))

x = []
for i in range(m):
    x_x = list(map(int,input().split()))
    x.append(x_x)
    continue

ans = 1000000000000
for i in x:
    s = a_i[i[0]-1] + b_j[i[1]-1] - i[2]
    if ans > s:
        ans = s

a_b = min(a_i) + min(b_j)

if a_b < ans:
    print(a_b)
else:
    print(ans)
# Judge status: Wrong Answer
a,b,c=input().split()
print("a[0]+b[0]+c[0]")
# Judge status: Accepted
N, M = map(int, input().split())

ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1 and M > 1:
    ans = M - 2
elif M == 1:
    ans = N -2
else:
    ans = (N - 2) * (M - 2)

print(ans)
# Judge status: Accepted
from math import log2
N = int(input())
ans = 0
if(N % 2 == 0 and N != 0):
  for i in range(int(log2(N))):
    ans += (N // 5 ** (i+1)) // 2
  print(ans)
else:
  print(0)
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))


res=3*10**8+1

for i in range(n-k+1):
	l=x[i]
	r=x[i+k-1]
	if l*r>=0:
		res=min(res,max(abs(l),abs(r)))
	else:
		res=min(res,abs(l)+abs(r)+min(abs(l),abs(r)))
	
print(res)
# Judge status: Wrong Answer
k = int(input())
a=0
n=0
if k%2==0 and k%5==0:
  print(-1)
else:  
  for i in range (10**9):
    a+= 7*10**i
    if a%k ==0:
      print(i+1)
      break
    if i==10**8:
      print(-1)
      break
# Judge status: Accepted
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
cd=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    x=ab[i][0]
    y=ab[i][1]
    ans = [float('inf')] * 2
    for j in range(m):
        man=abs(x-cd[j][0])+abs(y-cd[j][1])
        if ans[0]>man:
            ans=[man,j+1]

    print(ans[1])
# Judge status: Accepted
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b

n, k = inm()
a = inl()
start = a.index(1)
ans = 10**9
for i in range(max(0, start-k+1), min(n-1, start+k)):
    ans = min(ans, ceil(i, k-1) + ceil(n-i-1, k-1))
print(ans)
# Judge status: Wrong Answer
ST = input()
A, B = map(int, input().split())
U  = input()
S=ST[0]
T=ST[1]


if S==U:
       A=A-1 
else:
        B=B-1 

print(A,'',B)
# Judge status: Accepted
a,b=map(int,input().split())
i=1
while(1):
    p=int(i*0.08)
    q=int(i*0.1)
    if p==a and q==b:
        break
    i+=1
    if i>=100000:
        i=-1
        break
print(i)
# Judge status: Wrong Answer
a, b = [int(i) for i in input().split()]
print(a * b if 1 <= a <= 9 and 1 <= a <= 9 else -1)
# Judge status: Accepted
n=int(input())
ans=""
k=0
while n!=0:
    ans=str(n%2)+ans
    n=n-(n%2)*(-1)**k
    n=n//2
    k+=1
if ans=="":
    ans=0
print(ans)
# Judge status: Accepted
N = int(input())
max = 0
ans = 1

for i in range(1, N+1):
  count = 0
  k = i
  while (k % 2 == 0):
    count += 1
    k /= 2

  if count > max:
    max = count
    ans = i
    
print(ans)
# Judge status: Accepted
n,r=map(int,input().split())
if n>=10:print(r)
else:print(r+(100*(10-n)))
# Judge status: Accepted
a, b, c = map(int, input().split())
if a+b >= c:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,m=map(int,input().split())
mod=10**9+7
import sys
sys.setrecursionlimit(100002)
def kaijou(x):
  if x==1:
    return 1
  else:
    return ((x%mod)*kaijou(x-1))%mod

if abs(m-n)==1:
  n2=kaijou(n)
  m2=kaijou(m)
  print((n2*m2)%mod)
elif abs(m-n)==0:
  n2=kaijou(n)
  m2=kaijou(m)
  print(2*(n2*m2)%mod)
else:
  print(0)
# Judge status: Accepted
n, m = map(int, input().split())
if n == m == 1:
  print(1)
elif n == 1 or m == 1:
  print(max(n, m) - 2)
else:
  print((n - 2) * (m - 2))
# Judge status: Accepted
n, w = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(n)]

dp = [[0] * (w + 1) for _ in range(n + 1)]

for i in range(n):
    for j in range(w + 1):
        if j - items[i][0] >= 0:
            # 入れない時と入れる時
            dp[i + 1][j] = max(dp[i][j - items[i][0]] + items[i][1], dp[i][j])
        else:
            # 入れる時
            dp[i + 1][j] = dp[i][j]

print(dp[n][w])
# Judge status: Accepted
import itertools
A,B,C=map(int,input().split())
K=int(input())

l=[0,1,2,3,4,5,6,7]

for c  in itertools.product(l, repeat=3):
    if sum(c) == K and A*2**c[0]<B*2**c[1] and B*2**c[1]<C*2**c[2]:
      print("Yes")
      exit(0)
print("No")
# Judge status: Wrong Answer
import math
K = int(input())
A,B = map(int,input().split())

if K == 1:
    print("OK")
    exit()

x = math.floor(A/K)
y = math.floor(B/K)

if y-x >= 0:
    print("OK")
else:
    print("NG")
# Judge status: Accepted
a, b, c, k = map(int, input().split())

if k % 2:
    ans = b - a
else:
    ans = a - b

if abs(ans) > 10**18:
    print("Unfair")
else:
    print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    ans, cnt = N, 1
    for a in A:
        if a == cnt:
            ans -= 1
            cnt += 1
    if ans == N:
        print('-1')
    else:
        print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
def calc(num):
    return num+(num**2)+(num**3)

def start():
    num = int(input())
    return calc(num)

start()
# Judge status: Wrong Answer
n, m = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(m)]

ans = [0]*n

for s, c in X:
    if s==1 and c==0:
        print(-1)
        exit(0)
    if ans[s-1]:
        if ans[s-1] != c:
            print(-1)
            exit(0)
    else:
        ans[s-1] = c

if ans[0] == 0:
    ans[0] = 1

for i in ans:
    print(i, end="")
# Judge status: Wrong Answer
def shift_only(N,A):
    tmp = []
    counter = 0
    while True:
        flag = True
        # 全て偶数かを確認
        for num in A:
            if num%2 != 0:
                flag = False
        if flag == False:
            break
        A = [i/2 for i in A]
        counter +=1
    return counter
# Judge status: Wrong Answer
import numpy as np
I = np.array([int(_) for _ in open(0).read().split()])
N, K, Q = I[:3]
ans = I[3:] + K - Q
print(np.where(ans > 0, 'Yes', 'No')[1:], sep='\n')
# Judge status: Accepted
n, l = map(int, input().split())
s = list(input() for i in range(n))
s.sort()

x = "".join(s)

print(x)
# Judge status: Wrong Answer
n = int(input())
z = 1000000000
if n > z:
    a = n//z
    b = n%z
    print(a, 0, z, b+1, 0, b)
else:
    print(n, 0, 1, 1, 0, 0)
# Judge status: Accepted
#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : June 30, 2020
##################################################### SOURCE START #####################################################

N = int(input().strip())
As = list(map(int, input().strip().split()))

count = 0

while True:

    if all(a % 2 == 0 for a in As):
        count += 1
        As = [a // 2 for a in As]
    else:
        break

print(count)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker
# Judge status: Accepted
n,*aa = map(int, open(0).read().split())

ans = 0
for i in range(n):
    ans += aa[i]//2
    if aa[i]%2 and i+1<n and aa[i+1]:
        ans += 1
        aa[i+1] -= 1

print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort(reverse=True)

if n <= k:
    print(0)
else:
    print(sum(h[k:]))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt=0
for i in a:
  if i < 0:
    cnt+=1

b = list(map(abs, a))
if cnt%2 == 0:
  print(sum(b))
else:
  print(sum(b)-2*min(b))
# Judge status: Accepted
n = int(input())

f = False
for i in range(n+1):
    if int(i*1.08)==n:
        print(i)
        f = True
        break
if not f:
    print(':(')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0

for i in range(N-1):
    ans += B[A[i]-1]
    if A[i] + 1 == A[i+1] :
        ans += C[A[i]-1]
ans += B[A[N-1]-1]
print(ans)
# Judge status: Accepted
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
A,B,C,D=map(int,input().split())
c=int(C*D/gcd(C,D))
b=int(B//C)+int(B//D)-int(B//c)
a=int((A-1)//C)+int((A-1)//D)-int((A-1)//c)
print(int((B-b)-(A-1-a)))
# Judge status: Accepted
x = int(input())
if x % 11 == 0:
    res = x // 11 * 2
elif x % 11 <= 6:
    res = x // 11 * 2 + 1
else:
    res = x // 11 * 2 + 2
print(res)
# Judge status: Accepted
S = input()
ans = []

for s in S:
    if s == '0': ans.append(s)
    elif s == '1': ans.append(s)
    elif ans: ans.pop()

print(''.join(ans))
# Judge status: Accepted
n = int(input())

dp = ["No"] * 101
dp[4] = "Yes"
dp[7] = "Yes"
for i in range(8, 101):
    if dp[i - 4] == "Yes":
        dp[i] = "Yes"
    elif dp[i - 7] == "Yes":
        dp[i] = "Yes"

print(dp[n])