peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))

def imos(n,a):
  imos_l=[0 for i in range(n)]

  for i in range(n):
    x=i
    x_left=max(x-a[i],0)
    x_right=min(x+a[i],n-1)

    imos_l[x_left]+=1
    if (x_right+1)!=n:
      imos_l[x_right+1]-=1

  b=[0]
  for i in range(1,n+1):
    b.append(imos_l[i-1]+b[i-1])

  return(b[1:])

for i in range(k):
  a=imos(n,a)

  if a.count(n)==n:
    break

print(*a)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
L = []
H = []

for i in range(N):
  a = A[i]//400
  if a > 7:
    H.append(a)
  else:
    L.append(a)

if len(L) != 0:
  print(str(len(set(L)))+" "+str(len(set(L))+len(H)))
else:
  print("1 "+str(len(H)))
# Judge status: Accepted
N=int(input())
#print#(N)

D={}
for i in range(1,N+1):
    I=str(i)
    if (I[-1],I[0]) not in D:
        D[(I[-1],I[0])]=1
    else:
        D[(I[-1],I[0])]+=1
#print(D)
ans=0
for j in range(1,N+1):
    J=str(j)
    if (J[0],J[-1]) in D:
        ans+=D[(J[0],J[-1])]
print(ans)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    S = int(rl())
    x1, y1 = 0, 0
    x2, y2 = 1000000000, 1
    x3 = (x2 - S % x2) % x2
    y3 = (S + x3) // x2
    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


if __name__ == '__main__':
    solve()
# Judge status: Accepted
import math
A, B = map(int, input().split())
# 最小公倍数
g = int(A * B / math.gcd(A, B))
print(g)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

index = 0
cnt = 0
while index < n:
    if p[index] == index + 1:
        cnt += 1
        index += 2
    else:
        index += 1
print(cnt)
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a >= 10:
  print(b)
else :
  print(b + a*100)
# Judge status: Wrong Answer
def main():
    s = list(input())
    k = int(input())

    for i in range(len(s)-1):
        mod = 26-(ord(s[i])-97)%26
        if k >= mod:
            k -= mod
            s[i] = 'a'
        if k == 0:
            break
    
    if k > 0:
        mod = ((ord(s[-1])-97)+k)%26
        s[-1] = chr(mod+97)
    print(''.join(s))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, k, s = map(int, input().split())
a = [10**10] * n

for i in range(k):
	a[i] = s

print (*a)
# Judge status: Accepted
n = int(input())
total = 0
for i in range(1, n+1):
    total += i
    if total >= n:
        for j in range(1, i+1):
            if j != total-n:
                print(j)
        exit()
# Judge status: Accepted
a,b = map(int,input().split())
ans = ""
k = min(a,b)
l = max(a,b)
for i in range(l):
  ans += str(k)
print(ans)
# Judge status: Wrong Answer
from collections import deque
K = int(input())
que = deque()
que.extend([i for i in range(1,10)])

for k in range(K-2):
    out = que.popleft()
    div = out%10
    if div==0:
        que.extend([out*10,out*10+1])
    elif out%10==9:
        que.extend([out*10+8,out*10+9])
    else:
        que.extend([out*10-1+div,out*10+div,out*10+1+div])
print(que.popleft())
# Judge status: Wrong Answer
def invr():
    return(map(int, input().split()))


A, B, C, K = invr()

a = B + C
b = A + C
c = A + B
res = a - b
if K == 0:
    res = A - B
if abs(res) > 1000000000000000000:
    print("Unfair")
else:
    print(res)
# Judge status: Accepted
n, k = map(int, input().split())
apple = []
orange = []
for _ in range(n):
    apple.append(int(input()))
a = sorted(apple)
for i in range(n - k):
    b = - a[i] + a[i + k -1]
    c = a[-i-1] - a[-(i + k)]
    if b != 0 or c != 0:
        orange.append(min(b, c))
    else:
        orange.append(0)
        break
print(min(orange))
# Judge status: Accepted
N = int(input())
h_list = list(map(int, input().split()))

dp = [0] * N # DPテーブルの作成
dp[1] = abs(h_list[1] - h_list[0])

if N>= 3:
    for i in range(2, N):
        dp[i] = min(dp[i-1]+abs(h_list[i]-h_list[i-1]), dp[i-2]+abs(h_list[i]-h_list[i-2]))

print(dp[N-1])
# Judge status: Accepted
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
#total = 0
books = 0
#i = 0
A,B = [0],[0]
for i in range(n):
    A.append(A[i]+a[i])
for j in range(m):
    B.append(B[j]+b[j])

l = m

for i in range(n+1):
    if A[i]>k:
        break
    while B[l]>k-A[i]:
        l -= 1
    books = max(books,i+l)

print(books)
# Judge status: Accepted
import math
n = int(input())

def pF(n):
	fList = []
	while (n%2 == 0):
		fList.append(2)
		n = n//2

	x = int(math.sqrt(n))
	for i in range(3,x+1,2):
		while (n%i == 0):
			fList.append(i)
			n = n//i

	if n>2:
		fList.append(n)

	return set(fList)

pSet = pF(n)

ans = 0

for p in pSet:
	i = 1
	while (n%(p**i)==0):
		n = n//(p**i)
		ans += 1
		i += 1

print(ans)
# Judge status: Accepted
a, b, c =map(int, input().split())
if b - a == c - b:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        break
else:
    print("NG")
# Judge status: Accepted
a = int(input())
print(a + a **2 + a ** 3)
# Judge status: Accepted
X=int(input())
a_max=1
for b in range(2,X//2):
  a=1
  p=2
  while a<X:
    a=b**p
    p+=1
    if X >= a > a_max:
      a_max=a
print(a_max)
# Judge status: Wrong Answer
n,p=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]%2
one=sum(a)
zero=n-one
if p==1 and one==0:
    print(0)
    exit()
print(2**(n-1))
# Judge status: Accepted
h, n = map(int, input().split())
a = list(map(int, input().split()))
if sum(a)>= h:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()
item_set = set()
ans = 0

for _ in range(N):
    S = input()
    if S in item_set: continue
    item_set.add(S)
    ans += 1

print(ans)
# Judge status: Accepted
S = input()

odd_li = ['R', 'U', 'D']
even_li = ['L', 'U', 'D']

for i in range(len(S)):
    if i%2==0: #偶数
        if not S[i] in odd_li:
            print('No')
            exit()
    else:
        if not S[i] in even_li:
            print('No')
            exit()

print('Yes')
# Judge status: Wrong Answer
import random
S = ['ABC', 'ARC']
print(random.choice(S))
# Judge status: Accepted
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

A, B, K = map(int, input().split())
X = [i for i in range(100, 0, -1) if A % i == 0 and B % i == 0]
print(X[K - 1])
# Judge status: Accepted
import math

n = int(input())
m = n

answer = 0
i = 2
while i ** 2 <= m:
    t = 0
    while n % i == 0:
        n //= i
        t += 1
    answer += int((-1+math.sqrt(1+8*t)) / 2)
    i += 1

if n > 1000000:
    answer += 1

print(answer)
# Judge status: Accepted
import math
a,b = map(int,input().split())
x = math.ceil((a+b)/2)
print(x)
# Judge status: Accepted
import collections

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

count = collections.Counter(s)
ans = 0

if "R" in count.keys():
    if count["R"] != n:
        r_count = collections.Counter(s[:count["R"]])
        if r_count["R"] == 0:
            ans = count["R"]
        else:
            ans = r_count["W"]

print(ans)
# Judge status: Accepted
A, B = map(float, input().split())

a = int(A)
b = round(B * 100)

print(a * b // 100)
# Judge status: Wrong Answer
H, W =[int(i) for i in input().split()]
if H==1:
  print(min(0, W-2))
elif W==1:
  print(min(0, H-2))
else:
  print(min(H-2, 0)*min(W-2, 0))
# Judge status: Wrong Answer
from collections import deque

N=int(input())
S=input()
stack= []
ans=""

for i in range(N):
  if S[i]=="(":
    stack.append(S[i])
  else:
    if len(stack)>0:
      ans += stack.pop()+")"
    else:
      ans = "(" + ans + ")"

nokori=len(stack)
ans += nokori * "(" + nokori * ")"

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

if a*b%2 == 0 :
  print("Even")
  
else :
  print("Odd")
# Judge status: Wrong Answer
a=int(input())
if a<10:
  print(a)
if 10<=a<100:
  print(9)
if 100<=a<1000:
  print(9+a-100)
if 1000<=a<=10000:
  print(909)
if 10000<=a<100000:
  print(909+a-10000)
if a==1000000:
  print(90909)
# Judge status: Accepted
# solution

nim, mike= map(int, input().split())
if 2*nim>=mike:
  data=mike//2
else:
  data=nim+(mike-2*nim)//4
print(data)
# Judge status: Accepted
N = int(input())

mod = 10**9+7

if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    tmp = 2*(pow(10,N,mod)-pow(9,N,mod))-(pow(10,N,mod)-pow(8,N,mod))
    print(tmp%mod)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

x = b - a
y = c - b

if x is y:
  print('YES')
  
else:
  print('NO')
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = 0
p = 0

for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        if a == b and b == c:
            break
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z

    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)
# Judge status: Wrong Answer
n=int(input())
*a,=map(int,input().split())
s=sum(a)%(10**9+7)
c=0
for i in range(n):
    amod=a[i]%(10**9+7)
    c+=(s-amod)*amod
print(c%(10**9+7)//2)
# Judge status: Accepted
O = input()
E = input()

num = len(O) + len(E)
password =''
for i in range(1, num+1):
  if i % 2 ==0:
    n = i // 2
    password += E[n-1]
  else:
    n = i // 2 + 1
    password += O[n-1]
print(password)
# Judge status: Wrong Answer
A,B,C=list(map(int, input().split()))

if A==B:
    if A==C:
        print("no")
    else:
        print("yes")

elif A==C:
    if A==B:
        print("no")
    else:
        print("yes")

elif B==C:
    if B==A:
        print("no")
    else:
        print("yes")

else:
    print("no")
# Judge status: Accepted
s = list(input())

while True:
    s.pop()
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        break
# Judge status: Accepted
a, b = map(int, input().split())
ave=(a+b)/2
if ave-int(ave)==0:
    print(int(ave))
else:
    print(int(ave)+1)
# Judge status: Accepted
N = input()
if N.isupper():
    print("A")
else:
    print("a")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
crash = 0
cnt = 1
for i in A:
  if i == cnt:
    cnt += 1
  else:
    crash += 1
if cnt == 0:
  print(-1)
else:
  print(crash)
# Judge status: Accepted
N = tuple([int(j) for  j in input().split(' ')])

#0が含まれたら０
if N[0] <= 0 and N[1] >= 0:
    print("Zero")
elif N[0] < 0 and N[1] < 0:
    if (N[0] * - 1 - N[1] * - 1) % 2  == 0:
        print("Negative")
    else:
        print("Positive")
elif N[0] > 0 and N[1] > 0:
    print("Positive")
# Judge status: Accepted
N, K = input().split()
IK = int(K)
P = list(map(int, input().split()))
Sorted_P = sorted(P)
S = 0
i = 0

while i < IK:
    S = S + Sorted_P[i]
    i = i + 1


print(S)
# Judge status: Wrong Answer
h,w = map(int, input().split())

if h==1 or w == 1:
    print(1)
    exit()

if w%2!=0:
    x,y = w//2 + 1, w-(w//2+1)
else:
    x = y = w//2
print(x*round(h/2) + y * h//2)
# Judge status: Wrong Answer
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,M = MI()
from collections import defaultdict

d = defaultdict(int)
for i in range(M):
    a,b = MI()
    d[a] += 1
    d[b] += 1

print(sum(d[i] for i in d.keys()))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

c1 = 0
c2 = 0
c4 = 0
for i in range(n):
    if a[i] % 4 == 0:
        c4 += 1
    elif a[i] % 2 == 0:
        c2 += 1
    elif a[i] == 1:
        c1 += 1

n -= c2
n += 1
f = n // 2

if c4 >= f:
    print('Yes')
    quit()
else:
    print('No')
# Judge status: Accepted
s, w = [int(s) for s in input().split(" ")]
if w >= s:
  print("unsafe")
else:
  print("safe")
# Judge status: Wrong Answer
i=int(input())
if(i==7 or i==5 or i==3):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
X = int(input())

while True:
    
    flag = 0
    
    for i in range(2, X+1): #2からXまでのループ
        if (X+1) % i == 0: #対象はX+1という数
            flag = 1
            break
    if flag == 1:
        X += 1
        continue
    break
    
print(X + 1)
# Judge status: Accepted
#decimalを使った別解
import decimal
deci = decimal.Decimal
a,b = input().split()
x,y = deci(a),deci(b)
ans = (x*y).quantize(deci('0'),rounding=decimal.ROUND_FLOOR)
print(ans)
# Judge status: Accepted
N = int(input())
if N % 10 == 0:
  print(10)
else:
  ls = list(str(N))
  for i in range(len(ls)):
    ls[i] = int(ls[i])
  print(sum(ls))
# Judge status: Accepted
S = input()
T = input()

def chr_count(S):
    count = [0]*1000
    for i in S:
        count[ord(i)] += 1
    return count

Sc = chr_count(S)
Tc = chr_count(T)
Sc.sort()
Tc.sort()

if Sc == Tc:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
o = list(input())
e = list(input())

pw = []

for i in range(len(o)+len(e)):
    if i % 2 == 0:
        pw.append(o[i//2])
    else:
        pw.append(e[(i-1)//2])

print("".join(pw))
# Judge status: Accepted
import math

n, x, t = map(int, input().split())

count = math.ceil(n / x)

time = t * count

print(time)
# Judge status: Accepted
import sys
readline = sys.stdin.readline
from operator import itemgetter

def main():
    N = int(readline())
    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
    AB.sort(key=itemgetter(1))
    t = 0
    for a, b in AB:
        t += a
        if t > b:
            print('No')
            return
        
    print('Yes')

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
H = list(map(int,input().split()))

Dp = [0] * n

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
y,m,d=map(int,input().split("/"))
if m<=4:
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
a=list(map(int,input().split()))
print(int(a[0]+(a[1]/2)))
# Judge status: Accepted
N=int(input())
from collections import Counter
tmp=list(input())
da=Counter(tmp)
for _ in range(N-1):
  tmp=list(input())
  tmpd=Counter(tmp)
  for k, v in da.items():
    if not tmpd[k]:
      da[k]=0
    else:
      da[k]=min(v, tmpd[k])
ans=""
for k, v in da.items():
  ans+=str(k)*v
a="".join(sorted(ans))
print(a)
# Judge status: Accepted
A = input()
B = input()
print(int(6/(int(A)*int(B))))
# Judge status: Accepted
import math
a,b,c,d= map(int,input().split())
n=math.ceil(float(a)/d)
m=math.ceil(float(c)/b)
if m<=n:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
x = input().split()

a = int(x[0])
b = int(x[1])
c = int(x[2])
k = int(x[3])

if(a > k): # a > k
  print(a-k)
  exit()
elif(a == k):
  print(a)
  exit()
elif(k-a < b):  # k > a 
  print(a)
  exit()
elif(k-a == b):
  print(a)
  exit()
elif(k-a-b != 0):
  x = k - a - b
  print(a-x)
  exit()
# Judge status: Wrong Answer
n,k=map(int,input().split())
l=list(map(int,input().split()))
#(ng,ok]type
if k==0:print(max(l));exit()
def enough(x):
    return sum((i)//x for i in l )<=k
ok,ng=10**9,0
# [ok,ng)type->eraseng,ok=ok,ng

while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if enough(mid):ok=mid
    else:ng=mid
print(ok)
# Judge status: Accepted
# -*- coding: utf-8 -*-

exp=[1,2,4,8,16,32,64,128]
n=int(input())
for i in range(8):
    if n<exp[i]:
        print(exp[i-1])
        break
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
S = list(input())
K = int(input())

for i in range(len(S)-1):
    if S[i] == 'a':
        continue

    d = ord('z') - ord(S[i]) + 1
    if K >= d:
        S[i] = 'a'
        K -= d
    # print(K, d)

if K > 0:
    j = ord(S[-1]) + K % 26
    S[-1] = chr(j)

print(''.join(S))
# Judge status: Accepted
from collections import deque
K = int(input())
que = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    v = que.popleft()
    if v%10!=0:
        que.append(10*v+v%10-1)
    que.append(10*v+v%10)
    if v%10!=9:
        que.append(10*v+v%10+1)
print(v)
# Judge status: Wrong Answer
n = int(input())
s = input()
S = list(s[i] for i in range(n))
T = set(S)
x = 0
if len(T)<=2:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1, n-1):
      for k in range(j+1, n):
        if {s[i], s[j], s[k]}=={"R", "G", "B"} and i+k != 2*j:
          x += 1
print(x)
# Judge status: Accepted
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

H,Y=map(int,input().split())
if H==1 or Y==1:
    print(1)
else:
    print(H*Y//2+H*Y%2)
# Judge status: Accepted
N = input()
print('Yes' if N[0]=='9' or N[1]=='9' else 'No')
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
SA = sorted(A)

for _ in range(M):
  B, C = map(int, input().split())
  for i in range(B):
    if SA[i] >= C:
      continue
    if SA[i] < C:
      SA[i] = C
      
print(sum(SA))
# Judge status: Accepted
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    s = 0
    sm = 0
    for x, y in zip(a,b):
        tmp = y-x
        sm += tmp
        if tmp > 0:
            tmp //= 2
        s += tmp
    if s >= 0 and sm >= 0:
        print('Yes')
    else:
        print('No')

    
if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys

A, B, K = map(int, input().split())
if A >= K:
	A -= K
	print(A, B)
	sys.exit()

else:
	K -= A
	A = 0

	if B >= K:
		B -= K
	else:
		B = 0

	print(A, B)
# Judge status: Accepted
import math
N = int(input())
odd = math.ceil(N/2)
print(odd/N)
# Judge status: Wrong Answer
from functools import reduce
def cmb(r):
    numerator = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])
    denominator = reduce(lambda x, y: x * y % mod, [k + 1 for k in range(r)])
    return numerator * pow(denominator, mod - 2, mod) % mod
n,a,b = map(int,(input().split()))
ans=0
mod=10**9+7

ans=pow(2,n,10**9+7)-1
ans-=cmb(a)
ans-=cmb(b)
print(ans)
# Judge status: Wrong Answer
s = int(input())
sum = 0
for i in range(1,s+1):
    if i%3 == 0 and i%5 == 0:
        j=0
    elif i%3==0 or i%5==0:
        j=0
    else:
      
        sum += i
print(sum)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))

tmp = h[0] - 1
for i in range(1,n):
    if tmp == h[i]:
        tmp = h[i]
    elif tmp < h[i]:
        tmp = h[i] - 1
    else:
        print('No')
        exit()
print("Yes")
# Judge status: Accepted
N = int(input())
count = 0
for i in range(1, N+1):
  str_i = str(i)
  order = len(list(str_i))
  if order % 2 != 0:
    count += 1
print(count)
# Judge status: Accepted
import sys
n = int(input())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ab = sorted(ab,key=lambda x:x[1])
limit = 0
for i in range(n):
    limit += ab[i][0]
    if limit > ab[i][1]:
        print("No")
        sys.exit()

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

answer = a * b

if answer % 2 == 0:
    print('Even')
else:
    print('Odd')
# Judge status: Accepted
#!/usr/bin/env python3
a, b = map(int, input().split())
print(max(a+b, a*2-1, b*2-1))
# Judge status: Wrong Answer
n = int(input())
li = []
lia = []
ans = 0
f = 1
for i in range(n):
    li.append(input())
li.sort()
for i in range(n-1):
    if li[i] == li[i+1]:
        f += 1
        if f == ans:
            lia.append(li[i+1])
        if f > ans:
            lia = []
            ans = f
            lia.append(li[i+1])
    else:
        f = 1
for i in range(len(lia)):
    print(lia[i])
# Judge status: Accepted
kx=input().rstrip().split(" ")
k=int(kx[0])
x=int(kx[1])
if 500*k>=x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

def g(a):
    if a == []:
        return(1)
    else:
        b = sorted(a)
        for i in range(0,len(a)):
            if a[0] == b[i]:
                a.pop(0)
                return(i * math.factorial(len(a)) + g(a))

print(abs(g(P)-g(Q)))
# Judge status: Wrong Answer
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr


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


def main():
    N = int(input())
    if N % 2 == 1:
        return 0
    d = 10
    m = 1
    ret = 0
    while d < N:
        ret += m * (N // d)
        d *= 5
    return ret


if __name__ == "__main__":
    print(main())
# Judge status: Wrong Answer
#B
a,b = map(int,input().split())

if b == 1:
    print(0)
elif a >= b:
    print(1)
else:
    print((b-a)//a + 2)
# Judge status: Accepted
sumajedan = 0
sumadva = 0

n = int(input())

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

a.sort(reverse = True)

for x in range(n):
    if x%2 == 0:
        sumajedan=sumajedan + a[x]
    else:
        sumadva = sumadva + a[x]
print(sumajedan - sumadva)
# Judge status: Accepted
import sys
N = int(input())
if N < 10 or N > 99:
    sys.exit()

if int(str(N)[0:1]) == 9 or int(str(N)[-1]) == 9:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b = map(int, input().split())
print(a*b if a <10 and b<10 else -1)
# Judge status: Accepted
k = int(input())
odd = 0
for i in range(1, k+1):
  if i%2==0:
    odd += 1
even = k - odd
print(even * odd)
# Judge status: Wrong Answer
n = int(input())
L = [sorted(str(input())) for _ in range(n)]
m = float('inf')
for s in L:
    m = min(m, len(s))
ans = ''
for i in range(m):
    for j in range(1, n):
        if L[0][i] != L[j][i]:
            break
    else:
        ans = ans + L[0][i]
print(ans)
# Judge status: Accepted
import sys

N,M,X,Y=list(map(int,input().split()))
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort()
y.sort()

for Z in range(X+1,Y+1,1):
	if x[-1]<Z and y[0]>=Z:
		print("No War")
		sys.exit()

print("War")
# Judge status: Accepted
k,a,b=map(int,input().split())
import sys

if k<a-1 or b-a <2:
  print(k+1)
  sys.exit()
if (k+1-a) %2 ==0:
  print(a+(b-a)*(k+1-a)//2)
else:
  print(a+(b-a)*((k-a)//2)+1)
# Judge status: Accepted
# author:  Taichicchi
# created: 19.09.2020 21:01:22

import sys

N = int(input())

c = 0


for i in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        c += 1
    else:
        c = 0
    if c == 3:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())
if a + b == c or a + c == b or b + c == a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = input()

if s == "AAA" or s == "BBB":
  print("No")
else:
  print("Yes")
# Judge status: Accepted
from fractions import gcd
def main():
    x, y = map(int, input().split())
    if x % y == 0:
        print("-1")
    else:
        print(x)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys
from collections import Counter

inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = input()

cnt = 0

if not ("N" in s and "S" in s):
    cnt += 1
if not ("E" in s and "W" in s):
    cnt += 1

print("Yes") if cnt == 0 else print("No")
# Judge status: Accepted
N, M=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき

AB=[[int(i) for i in input().split()] for j in range(N)]  # 二次元配列入力　二次元マップみたいな入力のとき

AB.sort(key=lambda x: x[0])

money = 0
ct = M
for i in AB:
    money += min(ct, i[1]) * i[0]
    ct = ct - min(ct, i[1])
    if ct == 0:
        break
print(money)
# Judge status: Accepted
import sys
n=int(input())
dp=[0,0,0]


for _ in range(n):
    c=list(map(int,input().split()))
    ndp=[0,0,0]
    for i in range(3):
        for j in range(3):
            if i!=j:
                ndp[j]=max(ndp[j],dp[i]+c[i])
    dp=ndp

print(max(dp))