peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
S = input()

d = []
o = c = 0
for i in range(N):
    if S[i] == '(':
        o += 1
    else:
        c += 1
    d.append(o - c)
x = min(d)
print('(' * -x + S + ')' * (d[-1] - x))
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
a=sorted(a)
while(len(a)>1):
    d=(a[0]+a[1])/2
    a[0]=d
    a.pop(1)
    if(len(a)==1):
        break
print(a[0])
# Judge status: Accepted
import math

l=list(map(int, input().split(' ')))
a=l[0]
b=l[1]
h=l[2]
m=l[3]
hours = (h+m/60)/12
minutes = m/60
theta = 2*math.pi*(hours-minutes)
ans = a**2+b**2-2*a*b*math.cos(theta)
print(ans**0.5)
# Judge status: Wrong Answer
# 整数の入力
K = int(input())
# スペース区切りの整数の入力
A, B = map(int, input().split())


#出力　#自力
if B/K-(A-1)/K >= 1:
  print("OK")
else:
  print("NG")
# Judge status: Wrong Answer
def main():
    n, k = [int(i) for i in input().split()]
    #smallのバリエーション
    mod = int(10e9 + 7)
    res = 0
    for i in range(k, n+2):
        min_s = int(i*(i-1)/2)
        max_s = int(n*(n+1)/2 - (n-i)*(n-i+1)/2 )
        res += (max_s - min_s + 1) % mod
    print(int(res))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import copy
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
alist=[ 0 for i in range(n)]
for _ in a:
    alist[_ - 1] += 1
for j in aset:
    ans += (a.count(j)*a.count(j)-1) // 2
for u in a:
    print(ans - alist[u - 1])
# Judge status: Accepted
h, n = list(map(int, input().split()))
a = list(map(int, input().split()))

if(sum(a) >= h):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())
A = list(map(int, input().split()))
C=[]
for i in range(0,N):
    C.append(A.index(i+1)+1)
print(C)
# Judge status: Accepted
A, B = (int(i) for i in input().split())
def euclid(a, b):
    while b:
        a, b = b, a%b
    return a
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
try:
  print(len(list(set(prime_decomposition(euclid(A,B)))))+1)
except:
  print(1)
# Judge status: Wrong Answer
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

bingo = 'No'

for t in zip(*a):
    a.append(list(t))

a.append([a[i][i] for i in range(3)])
a.append([a[i][2-i]for i in range(3)])

for line in a:
    if all(item in b for item in a):
        bingo = 'Yes'

print(bingo)
# Judge status: Wrong Answer
K = int(input())
nana=7
kou=1
if K % 2 == 0:
    print(-1)
else:
    for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
    print(kou)
# Judge status: Accepted
n = int(input())

def d_sum(x):
    return sum(int(y) for y in str(x))

ans = float('inf')
for a in range(1, n):
    b = n - a
    dsum = d_sum(a) + d_sum(b)
    ans = min(ans, dsum)

print(ans)
# Judge status: Accepted
from fractions import gcd
 
def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
 
a, b = map(int, input().split())
print(len(set(pf(gcd(a, b)))) + 1)
# Judge status: Wrong Answer
N,P = map(int,input().split())
A = list(map(int,input().split()))

odd = 0
for v in A:
    if  v % 2:
        odd += 1 
even = N-odd

ans = (2**even)*(2**(odd-1) if 0 < odd else 0 )

print(ans)
# Judge status: Accepted
K = int(input())

cnt = 0
n = 7
while cnt <= K:
    cnt += 1
    if n % K == 0:
        break
    n = (10 * n + 7) % K

if cnt == K+1:
    print(-1)
else:
    print(cnt)
# Judge status: Accepted
from collections import deque

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

check = [0] * N

for i in reversed(range(1, N + 1)):
    x = i
    total = 0
    while x <= N:
        total += check[x - 1]
        x += i
    if total % 2 != A[i - 1]:
        check[i - 1] = 1

M = sum(check)
ans = deque()

for index, value in enumerate(check):
    if value == 1:
        ans.append(index + 1)

print(M)
if M > 0:
    print(*ans)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if max(e-a,e-b,e-c,e-d) <= k:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
N,P = list(map(int, input().split()))
a = list(map(int, input().split()))
num_odd = sum([i%2== 1 for i in a])
num_even = N - num_odd

ce = 2 ** num_even
co = 0
if num_odd > 0:
    co = 2 ** (num_odd - 1)
print(co * ce)
# Judge status: Wrong Answer
import string
alphabet = string.ascii_uppercase

N = int(input())
chara = input()

for ch in chara:
  index = alphabet.index(ch)
  pr = (index + N) % 26
  print(pr,end = '')
# Judge status: Accepted
# -*- coding: utf-8 -*-
# E - Sequence Decomposing
import sys 
from bisect import bisect_left
from collections import deque

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,read().split()))


INF = 10**31
q = deque([])

for a in A:
    idx = bisect_left(q, a)
    if idx == 0:
        q.appendleft(a)
    else:
        q[idx-1] = a
print(len(q))
# Judge status: Wrong Answer
n=int(input())
print(1000-n%1000)
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(N):
  x, y = map(int, input().split())
  if x == y:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    break
if ans == 3:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
ANS = sum(A)
A = Counter(A)
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    print(ANS + (C - B) * A[B])
    ANS += (C - B) * A[B]
    A[C] = A[C] + A[B]
    A[B] = 0
# Judge status: Accepted
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = 0
cnt = 0
for i in range(n):
    if d <= x:
        cnt += 1
    d += l[i]
if d <= x:
    cnt += 1
print(cnt)
# Judge status: Accepted
n = int(input())
A = sorted(map(int, input().split()), reverse=True)
if n % 2 == 0:
    ans = A[0] + 2 * sum(A[1:n//2])
else:
    ans = A[0] + 2 * sum(A[1:n//2]) + A[n//2]
print(ans)
# Judge status: Wrong Answer
K, X = map(int, input().split())
if 500*K >= X:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
S=input()
length=int(len(S))
#print(length)

if length<=1:
    print("No")
elif length%2!=0 :
    print("No")
else:
    for i in range(length//2):
        if S[2*i]=="h" and S[2*i+1]=="i":
            temp=0
        else:
            print("No")
            temp=1
            break
            
    if temp==0:
        print("Yes")
    else:
        nothing=0
# Judge status: Wrong Answer
N=int(input())

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 × "+ str(a))
print("WA × "+ str(b))
print("TLE × "+ str(c))
print("RE × "+ str(d))
# Judge status: Wrong Answer
def main():
    ans = 0
    n,m = map(int, input().split())
    if m >= n * 2:
        ans += n
        m -= n * 2
    else:
        for i in range(n):
            if i * 2 > m:
                ans = i - 1
                m = ans * 2
                break
    ans += m // 4
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
t1, t2 = c//b, a//d
if t1 < t2:
	print('Yes')
else:
	if t2 * d == a:
		print('No')
	else:
		if (t1 + 1) * b == c:
			print('Yes')
		else:
			print('No')
# Judge status: Accepted
from collections import defaultdict
N = int(input())
dic = defaultdict()
for i in range(1, N+1):
  k, v = input().split()
  dic[i] = [k, int(v)]
  
sorted_dic = sorted(dic.items(), key=lambda x:(x[1][0], -x[1][1]))
for k, *v in sorted_dic:
  print(k)
# Judge status: Accepted
N = int(input())

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

count_dic = {}
for i in range(N+1):
    i_tmp = i
    count = 0
    while True:
        if i == 0:
            break
        elif i_tmp % 2 == 0:
            i_tmp = i_tmp / 2
            count += 1
        else:
            break
    count_dic[i] = count
print(max(count_dic, key=count_dic.get))
# Judge status: Accepted
A,B,C=map(int,input().split())
K=int(input())

F=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            p=A*2**x
            q=B*2**y
            r=C*2**z
            if p<q<r and x+y+z<=K:
                F=1

if F:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
li = []
for i in range(1,n//2+1):
    a = sum(list(map(int, str(i))))
    b = sum(list(map(int, str(n-i))))
    li.append(a+b)
print(min(li))
# Judge status: Wrong Answer
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0

a.sort()

for x in range(n):
   if x % 2 == 0:
      ans -= a[x]
   else:
      ans += a[x]

print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
div = 10**9 + 7
ans = 0

for i in range(k, n+2):
  # 最小の和: 0 -> i-1 まで
  s_min = i * (i-1) // 2
  # 最大の和: n-i+1 -> n まで
  s_max = (n+1) * n // 2 - (n-i+1) * (n-i) // 2
  # とりうる個数
  s_count = s_max - s_min + 1
  # 答えに追加
  ans = (ans + s_count) % div

print(ans)
# Judge status: Accepted
N,L=map(int,input().split())
S=["0"]*N
for k in range(N):
    S[k]=input()
S.sort()
Answer=""
for k in range(N):
    Answer+=S[k]
print(Answer)
# Judge status: Accepted
import collections
n=int(input())
S=[]

for i in range(n):
    s=list(str(input()))
    cc=collections.Counter(s)
    S.append(cc)
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

ans=[]
for lets in alphabet:
    nin=10**10
    for i in range(n):
        nin=min(nin,S[i][lets])
    for j in range(nin):
        ans.append(lets)
print("".join(ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

s=input()
if s[-1]=='s':
    print(s+'es')
else:
    print(s+'s')
# Judge status: Accepted
import heapq

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort()

queue = []
day, i, ans = 0, 0, 0
while day <= m:
    while i < n and AB[i][0] <= day:
        heapq.heappush(queue, -AB[i][1])
        i += 1
    if len(queue):
        ans += -heapq.heappop(queue)
    day += 1
print(ans)
# Judge status: Accepted
n=int(input())

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


s=0
for i in range(1,n):
    if row[i-1]>row[i]:
        s+=row[i-1]-row[i]
        row[i]=row[i-1]
print(s)
# Judge status: Wrong Answer
S=input()
T=input()

if set(S)==set(T):
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
N, M = map(int, input().split())
L = []
for i in range(M):
  a, b = map(int, input().split())
  L.append([a, b])
ans = 'IMPOSIBLE'
for l in L:
  if l[0] == 1:
    if [l[1], N] in L:
      ans = 'POSSIBLE'
      break
print(ans)
# Judge status: Wrong Answer
z=input().split()
a=int(z[0])
b=int(z[1])
c=int(z[2])
goukei=a+b+c
count=0
while 1:
  count += 1
  
  goukei = goukei + 2
#   print(str(count)+':'+str(goukei))
  if goukei>=max([a,b,c])*3 and goukei%3 == 0:
    print(count)
    break
# Judge status: Accepted
def resolve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    cnt = 0
    while True:
        for i in range(N):
            if A[i] % 2 != 0:
                print(cnt)
                return
        for i in range(N):
            A[i] = A[i] // 2
        cnt += 1

            

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
line = list(map(int, input().split()))
for i in range(5):
  if line[i] == 0:
    print(i+1)
# Judge status: Wrong Answer
a=int(input())
s=input()
if a <3200 and s=='red':
    print("pink")
elif a<3200 and s=='pink':
    print("red")
# Judge status: Accepted
s = list(map(int,input()))

n = int(len(s)/2)

a = [0]*len(s)
b = [0]*len(s)

for i in range(n):
  a[2*i] = 0
  a[2*i+1] = 1
  b[2*i] = 1
  b[2*i+1] = 0

if len(s)%2 ==1:
  a[len(s)-1] = 0
  b[len(s)-1] = 1 


an = 0
bn = 0

for j in range(len(s)):
  if a[j] != s[j]:
    an += 1
  if b[j] != s[j]:
    bn += 1

print(min(an, bn))
# Judge status: Accepted
n=int(input());A=[0]*n
for i in range(1,n):
  c,s,f=map(int,input().split())
  for j in range(i):A[j]=max(-A[j]//f*-f,s)+c
print(*A,sep="\n")
# Judge status: Wrong Answer
w, h, n = map(int, input().split())

sx = [0, w]
sy = [0, h]

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        sx[0] = max(sx[0], x)
    if a == 2:
        sx[1] = min(sx[1], x)
    if a == 3:
        sy[0] = max(sy[0], y)
    if a == 4:
        sy[1] = min(sy[1], y)

print(max(0, (sx[1]-sx[0])*(sy[1]-sy[0])))
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
s=1000
for i in range(n-1):
  if A[i+1]>A[i]:
    s=s//A[i]*A[i+1]+s%A[i]
print(s)
# Judge status: Wrong Answer
N=int(input())
 
ans=0
odd=[]
for i in range(1,N+1):
  if i%2!=0:
    odd.append(i)
    
if N  <104:
  pass
else:
  for i in range(105,N+1):
    if i%2!=0:
      tmp=0
      for j in odd:
        if i%j==0:
          tmp=+1
      if tmp==8:
        ans+=1 
print(ans)
# Judge status: Accepted
time = 0
sum = 0
x = int(input())
sho = x//11
ans = 2*sho
mod = x % 11
if mod == 0:
    print(ans)
elif mod <= 6:
    print(ans+1)
else:
    print(ans+2)
# Judge status: Wrong Answer
X = input()
X = int(X)
 
if X >= 30:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
s = input()

s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')

if len(s) == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
print(sum(arr[:k]))
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
a=a-d
c=c-b
if a>=c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def funcao(lista, reverse, k):
    for i in lista:
        for j in reverse:
            if abs(i-j) > k:
                return ":("
    return "Yay!"


lista = []
lista.append(int(input()))
lista.append(int(input()))
lista.append(int(input()))
lista.append(int(input()))
lista.append(int(input()))
k = int(input())

lista.sort()
reverse = []
reverse = lista.copy()
reverse.reverse()

print(funcao(lista, reverse, k))
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

route = []
town = set()
now = 1

while True:
    now = a[now-1]
    if now in town:
        break
    town.add(now)
    route.append(now)

count = route.index(now)
if count >= k:
    print(route[k-1])
else:
    route = route[count:]
    num = (k-count)%len(route)
    print(route[num-1])
# Judge status: Accepted
a,b,k=map(int,input().split())
if b-a+1<=2*k:
  for i in range(a,b+1):
    print(i)
  exit()
for i in range(a,a+k):
  print(i)
for i in range(b-k+1,b+1):
  print(i)
# Judge status: Accepted
def main():
    n, m = map(int, input().split())
    count = 0

    if n == 1 and m == 1:
        ans = 1
    elif n == 1:
        ans = m - 2
    elif m == 1:
        ans = n - 2
    else:
        ans = (m - 2) * (n - 2)

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, K = map(int,input().split())
A = list(map(int,input().split()))
ans =  0

if((N-1)%(K-1)!=0):
    print((N-1)//(K-1)+1)
else:
    print((N-1)//(K-1))
# Judge status: Accepted
n = int(input())
a = sorted(list(map(int,input().split())),reverse = True)
c_ls = []
cnt = 0
for i in range(n-1):
  if a[i] == a[i+1]:
    cnt += 1
  else:
    cnt = 0
  if cnt == 3:
    c_ls.append(a[i])
  if (a[i] == a[i+1]) and(a[i] not in c_ls):
    c_ls.append(a[i])
  if len(c_ls) == 2:
    print(c_ls[0]*c_ls[1])
    exit()
print(0)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N = int(input())
XY = [tuple(map(int,input().split())) for i in range(N)]

A = []
B = []
for x,y in XY:
    A.append(x+y)
    B.append(x-y)

a = max(A) - min(A)
b = max(B) - min(B)
print(max(a,b))
# Judge status: Accepted
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
R = range(N-M+1)

for i in R:
    for j in R:
        for k in range(M):
            if A[j+k][i:i+M] != B[k]:
                break
        else:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
import queue
N, M = map(int, input().split())
E = [set() for i in range(N)]
for i in range(M):
  A, B = map(int, input().split())
  A, B = A-1, B-1
  E[A].add(B)
  E[B].add(A)
#print(E)
V = [-1]*N
q = queue.Queue()
q.put(0)
while not q.empty():
  p = q.get()
  s = E[p]
  for i in s:
    if V[i] < 0:
      V[i] = p
      q.put(i)
#print(V)
print("Yes")
for i in range(1, N):
  print(V[i]+1)
# Judge status: Accepted
candy_packs = sorted(list(map(int, input().split())))
if candy_packs[2] == (candy_packs[0] + candy_packs[1]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from math import ceil

N, D = map(int, input().split())
ans = ceil(N/(D*2 + 1))
print(ans)
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A+B<=14:
  print("Yay!")
elif abs(A-B)<=1:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
N = int(input())

xs = list(range(1,10))
xt = [(x*y) for x in xs for y in xs]

print('Yes') if N in xt else print('No')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if a[i] % 2 == 1:
        count += 1

print(str(count))
# Judge status: Accepted
# 入力
A, B = map(int, input().split())

# A,B,A+Bのうちどれか1つでも3で割り切れればPossible
if A % 3 == 0:
    print('Possible')
elif B % 3 == 0:
    print('Possible')
elif (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
import fractions
n,X = map(int,input().split())
x_ = list(map(int,input().split()))
x_.append(X)
x_.sort()
if len(x_) == 2:
    print(x_[1]-x_[0])
else:
    a = x_[1]-x_[0]
    for i in range(1,n):
        b = x_[i+1]-x_[i]
        a = fractions.gcd(a,b)
    print(a)
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()

ans = 100000000000000000000000000000000000000
for i in range(n-k+1):
    ans = min(ans, h[i+k-1] - h[i])
    print(i)
print(ans)
# Judge status: Wrong Answer
n=int(input())
B=[]
S = 0
for i in range(0,n):
    B.append((input()))
for m in range(n-1):
    if B[m][-1] == B[m+1][0]:
        S += 1
if S == n-1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x = int(input())

for t in range(1000000000):
    if 2 * x < t * (t + 1):
        print(t + 1)
        break
# Judge status: Wrong Answer
import numpy as np
import itertools
n,m,x = map(int, input().split())
ca = np.zeros((n,m+1))
for i in range(n):
    ca[i] = [int(i) for i in input().split()]

p = itertools.product([True,False], repeat = n)
ans_l = []
for i in p:
    ca_cut = ca[i,:]
    if len(ca_cut) == 0: 
        continue
    ca_cut_sum = ca_cut.sum(axis=0)
    if all(ca_cut_sum[1:] >= x):
        ans_l.append(ca_cut_sum[0])
if len(ans_l) == 0:
    ans = -1
else:
    ans = min(ans_l)
print(ans)
# Judge status: Wrong Answer
import math
n = int(input())
k = int(math.sqrt(n))
ans = 0
for i in range(1, k):
    t = int((n - 1) / i)
    ans += (t- i + 1) * 2 - 1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    print('Yes'if S[2] == S[3] and S[4] == S[5] else 'No')


if __name__ == "__main__":
    main()
# Judge status: Accepted
from math import log
x, y = map(int, input().split())
for i in range(64):
    x *= 2
    if x > y:
        print(i + 1)
        exit()
# Judge status: Accepted
a = list(map(int, input().split()))

a.sort(reverse=True)

#print(a)

print(str( int(str(a[0])+str(a[1])) + a[2]) )
# Judge status: Wrong Answer
n, a, b, c, d = map(int, input().split())
s = input()
e = 1
for i in range(b, min(c, d)-2):
    if s[i] == "." and s[i+1] == "." and s[i+2] == ".": e = 0
if c < d: e = 0
for i in range(a, max(c, d)-1):
    if s[i] == "#" and s[i+1] == "#": e = 1
print("Yes") if e == 0 else print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[1:3*n-n:2]))
# Judge status: Wrong Answer
S = input()
l = sorted(list(set(S)))

for i in range(len(l)):
  if len(l) == 1 and S == "a":
    ans = "b"
  elif ord(l[i]) !=  97 + i:
    ans = chr(97+i)
    break
  else:
    ans = "None"

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

if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
res = [[0]*len(abc), [n]*len(abc)]
#print(res)
for i in range(n):
    S = [s for s in input()]
    c = Counter(S)
    for k in c.keys():
        res[0][abc.index(k)] += 1
        res[1][abc.index(k)] = min(res[1][abc.index(k)], c[k])

ans = ''
for i in range(len(abc)):
    if res[0][i] == n:
        ans += abc[i]*res[1][i]
print(sorted(ans))
# Judge status: Accepted
from collections import Counter

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

mod=10**9+7

ans=1
c=Counter(s)

for v in c.values():
  ans*=(v+1)
  ans%=mod

print(ans-1)
# Judge status: Accepted
def actual(a, b):
    if a >= 9 or b >= 9:
        return ':('

    return 'Yay!'

a, b = map(int, input().split())
print(actual(a, b))
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input())
S = input()

W_num = [0] * N
E_num = [0] * N

for i in range(1, N):
    k = N - (i - 1) - 2
    W_num[i] = W_num[i-1] + 1 if S[i-1] == 'W' else W_num[i-1]
    E_num[k] = E_num[k+1] + 1 if S[k+1] == 'E' else E_num[k+1]

print(min([W_num[i] + E_num[i] for i in range(N)]))
# Judge status: Wrong Answer
a, b, c, d = (int(x) for x in input().split())

if a <= c <= b:
    if d <= b:
        print(d-c)
    else:
        print(b-c)
elif c <= a:
    if d <= b:
        print(d-a)
    else:
        print(b-a)
else:
    print(0)
# Judge status: Accepted
n = int(input())
x = list(map(int,input().split()))

ans = 10000000

for i in range(100):
    result = 0
    for j in x:
        result += (j - i )**2
    ans = min(result, ans)
        
print(ans)
# Judge status: Accepted
A=list(map(int,input().split()))
A.sort()
#print(A)
if A==[5,5,7]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
import math
a,b,x=map(int,input().split())
if (a**2)*b<=2*x:
    ans=2*(((a**2)*b)-x)
    print(math.degrees(math.atan(ans/a**3)))
else:
    ans=2*x
    q=math.degrees(math.atan(ans/(a*(b**2))))
    print(90-q)
# Judge status: Wrong Answer
import random

s = input()
s_len = s.count(s)

start = random.randint(0, s_len)
end = start + 3

nickname = s[start:end]
print(nickname)
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
from math import *
l,r=[0]*n,[0]*n
for i in range(1,n):
  l[i]=gcd(l[i-1],a[i-1])
  r[~i]=gcd(r[-i],a[-i])
m=0
for i in range(n):
  m=max(m,gcd(l[i],r[i]))
print(m)
# Judge status: Wrong Answer
n = int(input())
ans = 1
dummy1,dummy2 = divmod(n,2)
for i in range(1,dummy1+1):
  ans *= i
  ans *= n+1-i
  ans = ans % (10**9+7)
if dummy2 == 1:
  ans *= ((dummy1+1) % (10**9+7))
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N%2==1:
        print(0)
        exit()
    
    ans=0
    
    for i in range(1,100):
        a=2*pow(5,i)
        ans+=N//a
        
    print(ans)
        
    
    

main()
# Judge status: Wrong Answer
N = int(input())
S = input()
S = S.replace('#.','')
print((N-len(S))//2)
# Judge status: Accepted
N = int(input())
x = N * 800
y = N // 15 * 200

print(x - y)