Harryxun/stf_run huggingface dataset:
d, g = map(int, input().split())
o, c = zip(*[map(int, input().split()) for _ in range(d)])

comp = [(i+1)*o[i]+c[i]//100 for i in range(d)]
print(o, c)
print(comp)

G = g//100

# 大きい数（全問解く)
ans = sum(o)

for j in range(2**d):
    tmp = bin(j)
    ope = tmp[2:len(tmp)].zfill(d)

    now = 0  # 得点
    f = 1
    num = 0  # 問題数
    re = [[0, 0]]  # とかなかった問題の配列

    for i in range(d):
        if ope[i] == '1':
            now += comp[i]
            num += o[i]
        else:
            re.append([(i+1)*(o[i]-1), i+1])

        re.sort()
        re.reverse()

    if now < G:
        if now+re[0][0] < G:
            # 答えにならない
            now = sum(p)
            f = -1
        else:
            # 中途半端に解く問題数
            K = (G - now)//re[0][1]

            # 中途半端に解くときに、%==0ならちょうどgoalになるけど、それ以外の時は、ちょっとだけ点数が足りないから問題をもう一問解く
            if (G % re[0][1] > 0):
                K = K+1
            num += K
    if num < ans and f > 0:
        ans = num
print(ans)


### FIXED CODE ###

d, g = map(int, input().split())
o, c = zip(*[map(int, input().split()) for _ in range(d)])

comp = [(i+1)*o[i]+c[i]//100 for i in range(d)]

G = g//100

# 大きい数（全問解く)
ans = sum(o)

for j in range(2**d):
    tmp = bin(j)
    ope = tmp[2:len(tmp)].zfill(d)

    now = 0  # 得点
    f = 1
    num = 0  # 問題数
    re = [[0, 0]]  # とかなかった問題の配列

    for i in range(d):
        if ope[i] == '1':
            now += comp[i]
            num += o[i]
        else:
            re.append([(i+1)*(o[i]-1), i+1])

        re.sort()
        re.reverse()

    if now < G:
        if now+re[0][0] < G:
            # 答えにならない
            now = sum(o)
            f = -1
        else:
            # 中途半端に解く問題数
            K = (G - now)//re[0][1]

            # 中途半端に解くときに、%==0ならちょうどgoalになるけど、それ以外の時は、ちょっとだけ点数が足りないから問題をもう一問解く
            if ((G-now) % re[0][1] > 0):
                K = K+1
            num += K
    if num < ans and f > 0:
        ans = num
print(ans)
def find(x,ones):
    total = 0
    n = len(x)
    for i in range(n):
        total += int(x[i])*pow(2,n-i-1,ones)
        total %= ones

    return total

def solve(x,mod):
    x %= mod
    moves = 1
    while x != 0:
        x = x%(bin(x)[2:].count('1'))
        moves += 1

    return moves

def main():
    n = int(input())
    x = input()
    ones = x.count('1')
    less = find(x,ones-1)
    more = find(x,ones+1)
    for i in range(n):
        if x[i] == '0':
            print(solve(more+pow(2,n-i-1,ones+1),ones+1))
        else:
            print(solve(less-pow(2,n-i-1,ones-1),ones-1))


main()


### FIXED CODE ###

def find(x,ones):
    if ones == 0:
        return 0
    total = 0
    n = len(x)
    for i in range(n):
        total += int(x[i])*pow(2,n-i-1,ones)
        total %= ones

    return total

def solve(x,mod):
    x %= mod
    moves = 1
    while x != 0:
        x = x%(bin(x)[2:].count('1'))
        moves += 1

    return moves

def main():
    n = int(input())
    x = input()
    ones = x.count('1')
    less = find(x,ones-1)
    more = find(x,ones+1)
    for i in range(n):
        if x[i] == '0':
            print(solve(more+pow(2,n-i-1,ones+1),ones+1))
        else:
            if ones-1 == 0:
                print(0)
            else:
                print(solve(less-pow(2,n-i-1,ones-1),ones-1))


main()
m=[]
cnt=0
for i in range(5):
    x=int(input())
    menu.append(x)
m10=[i % 10 for i in m if i %10 >=1]
t=min(m10)
for i in m:
    if i %10==0:
        cnt += i
    else:
        cnt += ((i//10)+1)*10
print(cnt-t)

### FIXED CODE ###

m=[]
cnt=0
for i in range(5):
    x=int(input())
    m.append(x)
m10=[i % 10 for i in m if i %10 >=1]
if m10:
    t=min(m10)
    for i in m:
        if i %10==0:
            cnt += i
        else:
            cnt += ((i//10)+1)*10
    print(cnt-10+t)
else:
    print(sum(m))
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[x-1-i]:
    c+=1
print(c)


### FIXED CODE ###

a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()

count = 0
for b in B:
    upper = bisect_left(A, b)  # returns number of elements which satisfy a < b
    lower = bisect_right(C, b)
    count += upper * (len(C) - lower)

print(count)

### FIXED CODE ###

from bisect import bisect_left, bisect_right

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

A.sort()
C.sort()

count = 0
for b in B:
    upper = bisect_left(A, b)  # returns number of elements which satisfy a < b
    lower = bisect_right(C, b)
    count += upper * (len(C) - lower)

print(count)
N = int(input())

i = 1
AC = 0
WA = 0
TLE = 0
RE = 0
list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",a)
print("WA x" , b)
print("TLE x" , c)
print("RE x" ,d)


### FIXED CODE ###

N = int(input())

x = 0
while x < N:
    x = x + 1000

output = x - N
print(output)
n,a=map(int,input().split())
print(n*n-a)

### FIXED CODE ###

n=int(input())
a=int(input())
print(n*n-a)
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():

main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
import math
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N = ii()
    A = lmis()
    l = 1
    for a in A:
        l = lcm(l, a)
    print(sum(l//a for a in A) % N1097)


main()
a, b = map(int, input().split())
if a, b != 0:
    print(math.gcd(a, b))

### FIXED CODE ###

x, y = map(int, input().split())
while y > 0 :
    x, y = y, x % y
print(x)
#辺の重み(変化量)が0である場合は01DFSって特別なやつ
#0の場合はそこでBFSできる
import sys
from collections import deque
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
h,w=map(int,input().split())
c=[int(i)-1 for i in input().split()]
d=[int(i)-1 for i in input().split()]
s=[input() for i in range(h)]
inf=100000000
dp=[[-1 if s[i][j]=="#" else inf for j in range(w)] for i in range(h)]
dp[c[0]][c[1]]=0
now=deque([[c[0],c[1]]])
def bfs():
    global h,w,s,dp,now
    while len(now):
        i,j=now.popleft()
        for k,l in [[i-1,j],[i+1,j],[i,j-1],[i,j+1]]:
            if 0<=k<h and 0<=l<w:
                if dp[k][l]!=-1:
                    if dp[k][l]>dp[i][j]:
                        dp[k][l]=dp[i][j]:
                        now.appendleft([k,l])
        for k in range(i-2,i+3):
            for l in range(j-2,j+3):
                if 0<=k<h and 0<=l<w:
                    if dp[k][l]!=-1:
                        if dp[k][l]>dp[i][j]+1:
                            dp[k][l]=dp[i][j]+1
                            now.append([k,l])
bfs()
print(dp[d[0]][d[1]] if dp[d[0]][d[1]]!=inf else -1)

### FIXED CODE ###

#辺の重み(変化量)が0である場合は01DFSって特別なやつ
#0の場合はそこでBFSできる
import sys
from collections import deque
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
h,w=map(int,input().split())
c=[int(i)-1 for i in input().split()]
d=[int(i)-1 for i in input().split()]
s=[input() for i in range(h)]
inf=100000000
dp=[[-1 if s[i][j]=="#" else inf for j in range(w)] for i in range(h)]
dp[c[0]][c[1]]=0
now=deque([[c[0],c[1]]])
def bfs():
    global h,w,s,dp,now
    while len(now):
        i,j=now.popleft()
        if i>0:
            if dp[i-1][j]!=-1:
                if dp[i-1][j]>dp[i][j]:
                    dp[i-1][j]=dp[i][j]
                    now.appendleft([i-1,j])
        if j>0:
            if dp[i][j-1]!=-1:
                if dp[i][j-1]>dp[i][j]:
                    dp[i][j-1]=dp[i][j]
                    now.appendleft([i,j-1])
        if i<h-1:
            if dp[i+1][j]!=-1:
                if dp[i+1][j]>dp[i][j]:
                    dp[i+1][j]=dp[i][j]
                    now.appendleft([i+1,j])
        if j<w-1:
            if dp[i][j+1]!=-1:
                if dp[i][j+1]>dp[i][j]:
                    dp[i][j+1]=dp[i][j]
                    now.appendleft([i,j+1])
        for k in range(-2,3):
            for l in range(-2,3):
                if 0<=i+k<h and 0<=j+l<w:
                    if dp[i+k][j+l]!=-1:
                        if dp[i+k][j+l]>dp[i][j]+1:
                            dp[i+k][j+l]=dp[i][j]+1
                            now.append([i+k,j+l])
bfs()
print(dp[d[0]][d[1]] if dp[d[0]][d[1]]!=inf else -1)
import numpy as np
N = int(input())
S = np.empty(5, dtype=str)
for i in range(N):
    S[i] = input()

S_M = np.array([S[i] for i in range(N) if S[i][0] == 'M'])
S_A = np.array([S[i] for i in range(N) if S[i][0] == 'A'])
S_R = np.array([S[i] for i in range(N) if S[i][0] == 'R'])
S_C = np.array([S[i] for i in range(N) if S[i][0] == 'C'])
S_H = np.array([S[i] for i in range(N) if S[i][0] == 'H'])

souwa = 0
kahi = np.array([0, 0, 0, 0, 0])
kahi[0] = len(S_M)
kahi[1] = len(S_A)
kahi[2] = len(S_R)
kahi[3] = len(S_C)
kahi[4] = len(S_H)

kahi_not0 = kahi[kahi != 0]
if len(kahi_not0) <= 2:
    print(0)
else:
    for i in range(len(kahi_not0)-2):
        for j in range(i+1, len(kahi_not0)-1):
            for k in range(j+1, len(kahi_not0)):
                souwa += kahi_not0[i]*kahi_not0[j]*kahi_not0[k]

    if souwa >= 2**32:
        print(souwa/(2**32), end='')
        print(souwa-(souwa/(2**32))*2**32)
    else:
        print(souwa)

### FIXED CODE ###

import numpy as np
N = int(input())
S = [None]*N
for i in range(N):
    S[i] = input()

S_M = [S[i] for i in range(N) if S[i][0] == 'M']
S_A = [S[i] for i in range(N) if S[i][0] == 'A']
S_R = [S[i] for i in range(N) if S[i][0] == 'R']
S_C = [S[i] for i in range(N) if S[i][0] == 'C']
S_H = [S[i] for i in range(N) if S[i][0] == 'H']

souwa = 0
kahi = [0]*5
kahi[0] = len(S_M)
kahi[1] = len(S_A)
kahi[2] = len(S_R)
kahi[3] = len(S_C)
kahi[4] = len(S_H)

for i in range(len(kahi)-2):
    for j in range(i+1, len(kahi)-1):
        for k in range(j+1, len(kahi)):
            souwa += kahi[i]*kahi[j]*kahi[k]
print(souwa)
import sys
N = int(input())
arr = []

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

for i in range(N):
    arr.append(list(map(int, input().split())))

if N == 1:
    print(1)
    sys.exit()

C = []
for i in range(N):
    for j in range(N):
        if i < j:
            x = arr[i][0]-arr[j][0]
            y = arr[i][1]-arr[j][1]
            C.append([x, y])


C = get_unique_list(C)
S = [0 for i in range(len(C))]

for c in range(len(C)):
    tmp = [[[arr[0][0], arr[0][1]]]]
    for i in range(1, N):
        l = len(tmp)
        for j in range(l):
            for k in range(len(tmp[j])):
                x_t = tmp[j][k][0] - arr[i][0]
                y_t = tmp[j][k][1] - arr[i][1]
                arr_i = [arr[i][0], arr[i][1]]
                if C[c][0] == 0 and y_t%C[c][1] == 0:
                    if x_t == 0:
                        tmp[j].append(arr_i)
                        break
                    elif j == l - 1:
                        tmp.append(arr_i)
    
                elif C[c][1] == 0 and x_t%C[c][0] == 0:
                    if y_t == 0:
                        tmp[j].append(arr_i)
                        break
                    elif j == l - 1:
                        tmp.append(arr_i)
                else:
                    if x_t*C[c][1] == y_t*C[c][0]:
                        tmp[j].append(arr_i)
                        break
                    elif j == l - 1:
                        tmp.append(arr_i)
                        
    S[c] = len(tmp)
    
print(min(S))


### FIXED CODE ###

import sys
N = int(input())
arr = []

for i in range(N):
    arr.append(list(map(int, input().split())))

if N == 1:
    print(1)
    sys.exit()

d = {}

for i in range(N):
    for j in range(N):
        if i != j:
            x = arr[i][0] - arr[j][0]
            y = arr[i][1] - arr[j][1]
            if (x, y) in list(d.keys()):
                d[(x, y)] += 1
            else:
                d[(x, y)] = 1

print(N - max(list(d.values())))
import math
def calcH(O):
    n = len(O)
    return sum(-O.count(x)*1.0/n*math.log(O.count(x)*1.0/n) for x in set(O))
    
M = 256
while 1:
    n = int(raw_input())
    if n == 0: break
    I = map(int,raw_input().split())
    H = 10**10
    for S in range(16):
        for A in range(16):
            for C in range(16):
                O = []
                R = S
                for i in range(n):
                    R = (A*R+C)%M
                    O.append((I[i]+R)%M)
                tH = calcH(O)
                if tH < H:
                    H = tH
                    ans = [S,A,C]
    print " ".join(map(str,ans))

### FIXED CODE ###

import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))
S = input()
K = int(input())

if len(S) > K:
    for l in S:
        if l != '1':
            output = l
            break
else :
    for i in range(0, K):
        if S[i] != '1':
            output = S[i]
            break
            
print(output)

### FIXED CODE ###

S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')
X = int(input())

num_list = [0]*100000
num_list[0] = 1

for i in range(100001 + 105):
    if i == X:
        print(num_list[X])
        exit()

    for j in [100, 101, 102, 103, 104, 105]:
        if num_list[i]:
            num_list[i+j] = 1


### FIXED CODE ###

X = int(input())

num_list = [0]*(100001 + 105)
num_list[0] = 1

for i in range(100001 + 105):
    if i == X:
        print(num_list[X])
        exit()

    for j in [100, 101, 102, 103, 104, 105]:
        if num_list[i]:
            num_list[i+j] = 1

print(0)
import sys
x,y = input().split(),input().split()
h,w,hh,ww = x[0],x[1],y[0],y[1]
print((h - hh) * (w - ww))

### FIXED CODE ###

x,y = input().split(),input().split()
h,w,hh,ww = int(x[0]),int(x[1]),int(y[0]),int(y[1])
print((h - hh) * (w - ww))
s = list(input())
count = 0
s_1 = s.copy()
i = 0
while i < len(s)-1:
    if s[i] != s[i+1]:
        del s[i]
        del s[i]
        count += 2
        i = 0
    else:
        i += 1
    print(s)
        


print(count)

### FIXED CODE ###

s = list(input())
count0 =s.count('0')      
count1 =s.count('1')

print(min(count0,count1)*2)
N = int(input().split())
H = list(map(int,input().split()))
y = 0
z = H[i]
ans = 0
for i in range(N):
    x = H[i]
    if x >= y:
        y = x
    else:
        ans += y
        z = min(z,x)
        for j in range(i,N):
            p = H[j]
            z = min(z,p)
            H[j] -= z
print(ans)
        

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
y = 0
z = H[0]
ans = 0
while len(H) != 0:
    z = H[0]
    f = 1
    while z == 0:
        H.pop(0)
        if len(H) != 0:
            z = H[0]
        else:
            break
    for i in range(len(H)):
        x = H[i]
        if x == 0:
            ans += z
            for j in range(i):
                H[j] -= z
            z = H[0]
            f = 0
            break
        z = min(x,z)
    if f == 1:
        ans += z
        for i in range(len(H)):
            H[i] -= z
print(ans)
s=input()
weather=['Sunny','Cloudy','Rainy']
print(weather[weather.index(s)+1])

### FIXED CODE ###

s=input()
weather=['Sunny','Cloudy','Rainy','Sunny']
print(weather[weather.index(s)+1])
K, S = map(int(), input().split())

s = 0
for X in range(K+1):
	for Y in range(K+1):
		Z = S - (X+Y)
		if 0 <= Z and Z <= K:
			s += 1
print(s)


### FIXED CODE ###

K, S = map(int, input().split())

s = 0
for X in range(K+1):
	for Y in range(K+1):
		Z = S - (X+Y)
		if 0 <= Z and Z <= K:
			s += 1
print(s)
import numpy as np
import sys
sys.setrecursionlimit(10**10)
N,M = map(int,input().split())
R = [[] for _ in range(N)]
ans = np.zeros(N,dtype=int)
ans[0] = 1
queue = [1]
for _ in range(M):
    i,j = map(int,input().split())
    R[i-1].append(j)
    R[j-1].append(i)
    
def bfs(que):
    if que==[]:
        return
    i = que[0]
    for j in R[i-1]:
        if ans[j-1]==0:
            ans[j-1]=i
            que.append(j)
    que.pop(0)
    bfs(que)
    
bfs(queue)
print('Yes')
for i in range(1,N):
    print(ans[i])

### FIXED CODE ###

import numpy as np
import sys
sys.setrecursionlimit(10**7)
N,M = map(int,input().split())
R = [[] for _ in range(N)]
ans = np.zeros(N,dtype=int)
ans[0] = 1
queue = [1]
for _ in range(M):
    i,j = map(int,input().split())
    R[i-1].append(j)
    R[j-1].append(i)
    
def bfs(que):
    if que==[]:
        return
    i = que[0]
    for j in R[i-1]:
        if ans[j-1]==0:
            ans[j-1]=i
            que.append(j)
    que.pop(0)
    bfs(que)
    
bfs(queue)
print('Yes')
for i in range(1,N):
    print(ans[i])
n = int(input())
a = input().split(" ")

s = a[0]

for num in a[1:]:
	s^=num

ans = [0]*n

for i, num in enumerate(a):
	ans[i] = s^num

print(*ans)


### FIXED CODE ###

n = int(input())
aa = input().split(" ")
a = [int(c) for c in aa]

s = a[0]

for num in a[1:]:
	s ^= num

ans = [0]*n

for i, num in enumerate(a):
	ans[i] = s^num

print(*ans)
dn = input()
d, n = dn.split()
d = int(d)
n = int(n)
list = []
for i in range(1, 1000001):
    if i% 100**d:
        list.append(i)

print(list[n+1])


### FIXED CODE ###

d,n = map(int, input().split())
if n == 100:
    print(100**d * 101)
else:
    print(100**d * n)
n, m = map(int, input().split())
list = [int(i) for i in input().split()]
while(m):
  num = list.index(max(list))
  m -= 1
print(sum(list))

### FIXED CODE ###

a = input()
if a == "Sunny":
  print("Cloudy")
elif a == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
MOD = 10**9 + 7
S = int(input())
dp = [0]*(S+1)
dp[0] = 1
dp[3] = 1
for i in range(4,S+1):
    for k in range(i-2):
        dp[i] += dp[k]
print(dp[S]%MOD)

### FIXED CODE ###

MOD = 10**9 + 7
def comb(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    if k == 0:
        return 1
    iinv = [1] * (k + 1)
    ans = n
    for i in range(2, k + 1):
        iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
        ans *= (n + 1 - i) * iinv[i] % MOD
        ans %= MOD
    return ans
S = int(input())
ans = 0
for i in range(1,S+1):
    tmp = S
    tmp -= i*3
    if tmp < 0:
        continue
    ans += comb(i+tmp-1,tmp)
    ans %= MOD
print(ans)
a = int(input())
b = int(input())
ad = a+b
minus = a-b
cross = a*b
lis = [ad, minus, cross]
print(max(lis))

### FIXED CODE ###

a,b=input().split()
a = int(a)
b = int(b)
ad = a+b
minus = a-b
cross = a*b
lis = [ad, minus, cross]
print(max(lis))
n, k = map(int, input().split())
A = list(map(int, input().split()))
def f(x):
    return A[x-1]
c = 1
P = [1]
 
for i in range(k):
    c = f(c)
    P.append(c)
    if c in P:
        roop_start = P.index(c)
        roop_num  = i + 1-  roop_start
        break
a = (k - roop_start) % roop_num
for i in range(a):
    roop_start = f(roop_start)
print(roop_start)

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))
now = 1
 
for i in range(len(bin(k))-2):
    if (k>>i)&1:
        now = A[now-1]
    A = [A[a-1] for a in A]
print(now)
kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)
  for n in range(keta):
    kekka = kekka + str(out[n])
    if n == 0 and keta != 1 :
      print("-1")
      hantei = "NG"
  
  
if hantei == "OK":
  print(kekka)





### FIXED CODE ###

import math

N = int(input())
P = math.floor(N / 2)
P = P + N % 2
print(P)
N = int(raw_input())
K = int(raw_input())

if K ==1:
      print(0)
else:
      print(N-K)




### FIXED CODE ###

N,K =map(int, raw_input().split(" "))


if K == 1:
      print(0)
else:
      print(N-K)
S=input()
S=S[:len(S)-1]
s=list(S)
x,y=map(int,input().split())
fora=0
side=[]
updw=[]
while s[0]=="F":
  fora+=1
  s.pop(0)
flag=1#1のとき横向き、-1のときたて向き
step=0
while s:
  if s[0]=="T":
    s.pop(0)
    if flag==-1: updw+=[step]
    else: side+=[step]
    flag=flag*(-1)
    step=0
  else:
    s.pop(0)
    step+=1
    if len(s)==0:
      if flag==-1: updw+=[step]
      else: side+=[step]
ypossi=len(side)
tpossi=len(updw)
xdp=[[0 for i in range(2*len(S)+1)] for j in range(ypossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
xdp[0][fora+len(S)]=1 
for i in range(ypossi):
  for j in range(2*len(S)+1):
    if j-side[i]>=0:
      if xdp[i][j-side[i]]==1:xdp[i+1][j]=1
    if j+side[i]<2*len(S)+1:
      if xdp[i][j+side[i]]==1:xdp[i+1][j]=1
        
ydp=[[0 for i in range(2*len(S)+1)] for j in range(tpossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
ydp[0][len(S)]=1 
for i in range(tpossi):
  for j in range(2*len(S)+1):
    if j-updw[i]>=0:
      if ydp[i][j-updw[i]]==1:ydp[i+1][j]=1
    if j+updw[i]<2*len(S)+1:
      if ydp[i][j+updw[i]]==1:ydp[i+1][j]=1
if xdp[ypossi][x+len(S)]==1 and ydp[tpossi][y+len(S)]==1:
  print("Yes")
else: print("No")

### FIXED CODE ###

S=str(input())
s=list(S)
x,y=map(int,input().split())
fora=0
side=[]
updw=[]
while s[0]=="F":
  fora+=1
  s.pop(0)
  if len(s)==0:break
flag=1#1のとき横向き、-1のときたて向き
step=0
while s:
  if s[0]=="T":
    s.pop(0)
    if step:
      if flag==-1: updw+=[step]
      else: side+=[step]
    flag=flag*(-1)
    step=0
  elif s[0]=="F":
    s.pop(0)
    step+=1
    if len(s)==0:
      if flag==-1: updw+=[step]
      else: side+=[step]
  else: break
ypossi=len(side)
tpossi=len(updw)
X=sum(side)+fora+abs(x)
Y=sum(updw)+abs(y)
xdp=[[0 for i in range(2*X+1)] for j in range(ypossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
xdp[0][fora+X]=1 
for i in range(ypossi):
  for j in range(2*X+1):
    if j-side[i]>=0:
      if xdp[i][j-side[i]]==1:xdp[i+1][j]=1
    if j+side[i]<2*X+1:
      if xdp[i][j+side[i]]==1:xdp[i+1][j]=1

ydp=[[0 for i in range(2*Y+1)] for j in range(tpossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
ydp[0][Y]=1 
for i in range(tpossi):
  for j in range(2*Y+1):
    if j-updw[i]>=0:
      if ydp[i][j-updw[i]]==1:ydp[i+1][j]=1
    if j+updw[i]<2*Y+1:
      if ydp[i][j+updw[i]]==1:ydp[i+1][j]=1
if xdp[ypossi][x+X]==1 and ydp[tpossi][y+Y]==1:
  print("Yes")
else: print("No")
import math


def run(N):
    ans = 0
    if N % 2 == 0:
        for i in range(int(math.log(N, 5))):
            ans += N // (10 * (5**i))
    return ans


def main():
    N = int(input())
    print(run(N))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math


def run(N):
    if N == 0:
        return 0
    ans = 0
    if N % 2 == 0:
        for i in range(int(math.log(N, 5))):
            ans += N // (10 * (5**i))
    return ans


def main():
    N = int(input())
    print(run(N))


if __name__ == '__main__':
    main()