peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s = input()
days = {"SUN":7,
         "MON":6,
         "TUE":5,
         "WED":4,
         "THU":3,
         "FRI":2,
         "SAT":1,
        }
if s in days:
  print(days[s])
# Judge status: Wrong Answer
# d
import numpy as np
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = np.array(list(input()))
t = np.where(t == 'r', p, t)
t = np.where(t == 's', r, t)
t = np.where(t == 'p', s, t)
t = t.astype(dtype='int64')
tt = t
for i in range(n-k):
    if t[i] == t[i+k]:
        tt[i+k] = 0
    elif t[i] != t[i+k]:
        pass
            
print(np.sum(tt))
# Judge status: Accepted
import sys

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

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

num_flag = [0 for i in range(n)]

for item in a:
    num_flag[item - 1] += 1

# while 0 in num_flag:
#     num_flag.remove(0)

# num_flag.sort()

# cnt = 0
# while len(num_flag) > k:
#     print(len(num_flag))
#     cnt += num_flag[0]
#     num_flag.pop(0)

num_flag.sort(reverse=True)

cnt = 0
for i in range(k):
    cnt += num_flag[i]

print("{}".format(n - cnt))
# Judge status: Accepted
def f(n):
  ans = 0
  while n>0:
    n//=5
    ans+=n
  return ans

x = int(input())
print(0 if x%2 else f(x//2))
# Judge status: Wrong Answer
K = int(input())  # ぜんぜんちがう
ans = -1
 
def moduloseven(K):
	for i in range(1000):
		sev = int(str(7)*(i+1))
		if sev % K == 0:
			ans = i+1
			break
		else:
			ans = K-1
	return(ans)
 
if K % 2 != 0:
	if K % 5 != 0:
		ans = moduloseven(K)
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
ans = min((n*2 + m)//4, m//2)
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
one_li = []
to_n_li = []
for _ in range(m):
    a,b = map(int,input().split())
    if a == 1:
        one_li.append(b)
    if b == n:
        to_n_li.append(a)
for o in one_li:
    if o in to_n_li:
        print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
from operator import itemgetter

N = int(input())
A = list(map(int,input().split()))
B =[]
for i,c in enumerate(A):
    B.append([i+1,c])

B = sorted(B, key=itemgetter(1))
print(B)
ans =[]
for i in range(N):
    ans.append(B[i][0])

C =map(str,ans)
C =' '.join(C)
print(C)
# Judge status: Accepted
import numpy as np
N, M = map(int, input().split())
A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])
# print('AB', A, B)
for i in range(N - M + 1):
    for j in range(N - M + 1):
        # print('i j', i, j)
        A_subset = A[i:i + M, j:j + M]
        # print('A_subset', A_subset)
        if np.all(A_subset == B):
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
n=int(input())

s=[]
e=[]
for i in range(n):
  a,b=map(int,input().split())
  s.append(a)
  e.append(b)


s=sorted(s)
e=sorted(e,reverse=True)

if n%2==1:
  x=n//2
  ans=(e[x]-s[x]+1)

else:
  x=n//2
  ts=(s[x]+s[x-1])/2
  te=(e[x]+e[x-1])/2
#  print(ts,te)
  ans=(te-ts)//0.5+1


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

white = [0] * (N + 1)
for i in range(N):
    if S[i] == ".":
        white[i + 1] = white[i] + 1
    else:
        white[i + 1] = white[i]

ans = N
for i in range(N + 1):
    tmp = (i - white[i]) + (white[-1] - white[i])
    if tmp < ans:
        ans = tmp

print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
if N >= K:
    c = N - (int(N/K)-1)*K
    print(min(c, abs(c-K)))
else:
    print(N)
# Judge status: Wrong Answer
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

m = min(a,b,c,d,e)

print(n // m + 5)
# Judge status: Accepted
n=int(input())
if 104>=n:
  print(0)
elif 105<=n<=134:
  print(1)
elif 135<=n<=164:
  print(2)
elif 165<=n<=188:
  print(3)
elif 189<=n<=194:
  print(4)
else:
  print(5)
# Judge status: Accepted
N,L=map(int,input().split())

Apple_List1=[]
Apple_List2=[]
for i in range(N):
    Apple_List1.append(L+i)
    Apple_List2.append(abs(L+i))

#Apple_List=abs(Apple_List)
Apple_List2.sort()

flag=0
if Apple_List2[0] in Apple_List1:
    flag=1
elif -Apple_List2[0] in Apple_List1:
    flag=-1
    
print(sum(Apple_List1)-flag*Apple_List2[0])
# Judge status: Wrong Answer
from math import sqrt

N = int(input())
count = 0
for c in range(1,N):
  for a in range(1,int(sqrt(c))):
    if c % a == 0:
      if c == a*a:
        count += 1
      else:
        count += 2
print(count)
# Judge status: Wrong Answer
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def main():
    A, B, C, D = map(int, input().split())
    print(min(B, D) - max(A, C) if B > C else 0)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if b<=c or a>=d :# 1,2
  print(0)
else:
  if (a<=c and b<d) or (a<c and b<=d):#2
    print("a",b-c)
  elif a<=c and b>d:
    print("b",d-c)
  elif a>c and b<=d:
    print("c",b-a)
  elif a==c and b==d:
    print(0)
# Judge status: Accepted
a, b, c = map(int, input().split())

cnt = 0

while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and a == b and b == c and c == a:
        cnt = -1
        break

    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    cnt += 1

print(cnt)
# Judge status: Accepted
import math
import itertools
def gcd(lst):
  return math.gcd(math.gcd(lst[0],lst[1]), lst[2])

k = int(input())
lst = [i for i in range(1,k+1)]
itr = itertools.combinations_with_replacement(lst, 3)
ans = 0

for i in itr:
  st = set(i)
  num = len(st)
  if num == 1:
    ans += i[0]
  elif num == 2:
    a,b = st
    ans += math.gcd(a,b) * 3
  else:
    ans += math.gcd(math.gcd(i[0],i[1]), i[2]) * 6

print(ans)
# Judge status: Accepted
s = input()
t = input()
count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(count)
# Judge status: Accepted
a,b,c,d = (int(x) for x in input().split())

ac = a * c
ad = a * d
bc = b * c
bd = b * d

print(max([ac,ad,bc,bd]))
# Judge status: Accepted
from math import *

N=int(input())
abcde=[int(input()) for _ in range(5)]
print(ceil(N/min(abcde))+4)
# Judge status: Wrong Answer
from itertools import accumulate
N,Q = map(int,input().split())
S = str(input())
lr = [list(map(int,input().split())) for _ in range(Q)]
sl = [0]*N
for i in range(N):
  if S[i:i+2] == "AC":
    sl[i] = 1
slr = [0]+list(accumulate(sl))
ans = 0
for l,r in lr:
  l -= 1
  r -= 1
  ans = slr[r]-slr[l]
  if slr[r] == slr[r-1]:
    ans -= 1
  if slr[l] != slr[l-1]:
    ans += 1
  print(ans)
# Judge status: Wrong Answer
N, X, Y = map(int, input().split())
ans = [0] * N

for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        d = min(
            j - i,
            abs(i - X) + (Y - X - 1) + abs(j - Y),
            abs(j - X) + (Y - X - 1) + abs(i - Y)
        )
        ans[d] += 1

print(*ans[1:])
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
a_L = list(map(int,input().split()))
q = int(input())

L = Counter(a_L)
print(0)
# all_sum = sum(a_L)



# ans_L = []
# for i in range(q):
#     b,c = map(int,input().split())
#     if L[b] != 0:
#         diff = (c-b) * L[b]
#         all_sum = all_sum+diff
#         L[c] += L[b]
#     ans_L.append(all_sum+1)


# for i in ans_L:
#     print(i)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
  if a[i-2] < a[i-1] < a[i]:
    ans += 1
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

D = {}
for a in A:
    if a not in D:
        D[a] = 1
    else:
        D[a] += 1
E = sorted(D.items())
c = 0
i = 0
l = len(D)
while l > K:
    if (K - l) in D.values():
        c += K - c
        l -= K - c
    else:
        c += E[-1 -i][1]
        l -= E[-1 -i][1]
        i += 1
print(c)
# Judge status: Wrong Answer
import sys
import math


N = int(input())

timelis = []
for _ in range(N):
    A,B = map(int, input().split())
    timelis.append([A,B])

timelis = sorted(timelis,key=lambda x: x[1])

sum_time = 0
for i in timelis:
    need = i[0]
    deadline = i[1]

    sum_time = sum_time + need

    if sum_time > deadline:
        print(sum_time,need,deadline)
        print("No")
        sys.exit()

print("Yes")
# Judge status: Accepted
# coding: utf-8
N, M = map(int, input().split())
print("Yes" if N == M else "No")
# Judge status: Accepted
# ι⊥l
def ABC_58_A():
    A,B,C = map(int, input().split())
    
    if B == (A+C)/2:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':

    ABC_58_A()
# Judge status: Wrong Answer
d,n = map(int,input().split())

if d == 0:
  print(n)
elif d == 1:
  print(100*n)
else:
  print(1000*n)
# Judge status: Accepted
s=input()[::-1]+'0'
n=len(s)
ans=0
flg=False
for i in range(n):
    a=int(s[i])
    if flg:
        a+=1
    if a==5:
        if int(s[i+1])>=5:
            ans+=5
            flg=True
        else:
            ans+=5
            flg=False
    elif a>5:
        ans+=10-a
        flg=True
    else:
        ans+=a
        flg=False
if flg:
    ans+=1
print(ans)
# Judge status: Wrong Answer
a,b= input().split()
a,b=int(a),int(b)
if a+b <24:
    print(a+b)
elif a+b>24:
    print(a+b-24)
# Judge status: Accepted
A,B,C,D = map(int,input().split())

if C % B != 0:
    ans_A =  ((C // B) + 1)
else:
    ans_A = C // B

if A % D != 0:
    ans_C =  A // D + 1
else:
    ans_C = A // D


if ans_A <= ans_C:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x = int(input())

result = 100
count = 0
while True:
    count += 1
    result = int(result * 1.01)
    if result >= x:
        break
print(count)
# Judge status: Accepted
from scipy.special import comb
s = int(input())
l = s // 3
# print(l)
mod = pow(10, 9) + 7
ans = 0
last = s % 3
for i in range(l, 0, -1):
    ans += comb(i+last-1, last, exact=True) % mod
    # print(comb(i+last-1, last, exact=True))
    # ans += pow(i, last, mod)
    ans %= mod
    last += 3
print(ans)
# Judge status: Accepted
N=int(input())
can=[]
for i in range(1,int(N**0.5)+1):
  if N%i==0:
    can.append(i-1+N//i-1)
    

print(min(can))
# Judge status: Wrong Answer
L, R, d = map(int, input().split())

num_lower = int(L / d)
num_upper = int(R / d)
ans = num_upper - num_lower

print(ans)
# Judge status: Wrong Answer
inputline = list(map(lambda x:int(x), input().split(" ")))
print(inputline[1], inputline[2], inputline[0])
# Judge status: Wrong Answer
D, T, S = map(int,input().split())

t = D // S

if t < T:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
h=list(map(int,input().split()))
count=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]>h[b-1]:
    count[b-1]=0
  elif h[a-1]==h[b-1]:
    count[a-1]=0
    count[b-1]=0
  else:
    count[b-1]=0
print(sum(count))
# Judge status: Accepted
import fractions
from functools import reduce

N=int(input())
T = [int(input()) for i in range(N)]

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))
# Judge status: Wrong Answer
cookie = list(map(int,input().split()))

if len(set(cookie)) == 1:
  print(-1)
else:
  con = 0
  while True:
    a = cookie[0] // 2
    b = cookie[1] // 2
    c = cookie[2] // 2
    cookie[0] = b + c
    cookie[1] = c + a
    cookie[2] = a + b
    con += 1
    if any([i % 2 != 0 for i in cookie]):
      break

  print(con)
# Judge status: Accepted
from sys import stdin
import numpy as np
n, k = map(int, stdin.readline().split())
a = np.array(stdin.readline().split(), dtype=np.int64)

ng = 0
ok = 10 ** 9 + 1
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if np.sum(0 - - a // mid - 1) <= k:
        ok = mid
    else:
        ng = mid
print(ok)
# Judge status: Accepted
### a<=b<=cととることとし、a,bを固定すると
### cは　c<a+b
from bisect import bisect_left
def main():
    N = int(input())
    lst = list(map(int, input().split()))
    sor = sorted(lst)
    res = 0
    for i in range(N):
        for j in range(i+1, N):##ここでa<=bを満たしている
            ab = sor[i] + sor[j]
            highbound = bisect_left(sor, ab)
            res += highbound - j - 1
    print(res)
main()
### ライブラリを使おう！！！
# Judge status: Accepted
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
A = sorted([X[i][0] for i in range(N)])
B = sorted([X[i][1] for i in range(N)])
if N%2==1:
    k = (N+1)//2
    a = A[k-1]
    b = B[k-1]
    print(b-a+1)
else:
    a2 = A[N//2-1]+A[N//2]
    b2 = B[N//2-1]+B[N//2]
    print(b2-a2+1)
# Judge status: Wrong Answer
x=int(input())
days=[]
for i in range(x):
    days.append(list(map(int,input().split())))
print(days)
dp=[0]*3
dp=days[0]
for cur in range(1,x):
    m=[0]*3
    for i in range(3):
        for j in range(3):
            if i!=j:
                m[i]=max(m[i],days[cur][i]+dp[j])
    dp=m
print(max(dp))
# Judge status: Accepted
Ss=input()
Ts=input()
s=[_ for _ in Ss]
t=[_ for _ in Ts]
l=len(Ss)
for i in range(l):
  temp=s[l-1]
  for j in range(l-1,-1,-1):
    s[j]=s[j-1]
  else:
    s[0]=temp
  if s==t:
    res='Yes'
    break
else:
  res='No'
print(res)
# Judge status: Accepted
a,b,c = map(int, raw_input().split(' '))
print 'Yes' if a+b < c and 4*a*b < (c - a - b) **2 else 'No'
# Judge status: Accepted
K, A, B = map(int, input().split())

if B - A <= 2:
    print(1 + K)
elif A + 1 > K:
    print(1 + K)
else:
    rest = K - A + 1
    b = (rest // 2) * (B - A) + rest % 2 + A
    print(max(1 + K, b))
# Judge status: Wrong Answer
from collections import deque

S = input()
Q = int(input())

que = deque()

for s in S:
    que.append(s)

for _ in range(Q):
    query = input().split()

    if query[0] == "1":
        r = que.pop()
        l = que.popleft()
        que.append(l)
        que.appendleft(r)
    else:
        if query[1] == "1":
            que.appendleft(query[2])
        else:
            que.append(query[2])


print("".join(list(que)))
# Judge status: Accepted
N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
ans = 0
for a in A:
    x = x-a
    if x<0:
        break
    ans+=1
print(ans-(x>0))
# Judge status: Accepted
S = input()
N = len(S) + 1
a = [0] * N
b = [0] * N
for i in range(0, N-1):
    if S[i] == '<':
        a[i+1] = a[i] + 1

for i in range(N-2, -1, -1):
    if S[i] == '>':
        b[i] = b[i+1] + 1

res = [max(x, y) for x, y in zip(a, b)]

print(sum(res))
# Judge status: Accepted
import sys

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

if N == M == 1:
    print(1)
    sys.exit()
elif N == 1 or M == 1:
    print(max(max(N, M)-2, 0))
    sys.exit()

N = max(0, N-2)
M = max(0, M-2)

print(N*M)
# Judge status: Accepted
from collections import deque

s = deque(input())
t = deque(input())
n=len(s)

yes = False
for _ in range(n):
    if s == t:
        yes = True
        break
    s.rotate()

print('Yes' if yes else 'No')
# Judge status: Accepted
a = int (input ())
b = int (input ())
c = int (input ())
d = int (input ())
e = int (input ())
k = int (input ())
if k >= e-a:
  print ('Yay!')
else:
  print (':(')
# Judge status: Accepted
A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)
# Judge status: Wrong Answer
n,T=map(int,input().split())
C=1000
for i in range(n):
    c,t=map(int,input().split())
    if T>=t:
        C=min(c,C)
print(C if C<1000 else "TLE")
# Judge status: Accepted
N = int(input())

sigma = 0
for i in range(1, N):
    sigma += (N-1) // i

print(sigma)
# Judge status: Accepted
X, A, B = map(int, input().split())
if X-B+A < 0:
    print('dangerous')
elif B <= A:
    print('delicious')
else:
    print('safe')
# Judge status: Accepted
N, M, K = map(int, input().split())

# nは行で押したボタンの数、mは列で押したボタンの数。
for n in range(N+1):
    for m in range(M+1):
        if n * (M - m) + m * (N - n) == K:
            print("Yes")
            exit()
else:
    print("No")
# Judge status: Accepted
def main():
    from itertools import accumulate
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    accA = list(accumulate(A))
    accB = list(accumulate([0] + B))
    ans = 0
    for i in range(N):
        cur = accA[i] + (accB[N] - accB[i])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A,B = map(int,input().split())
if(B % A == 0):
	print(-1)
	exit()
else:
	print(A)
# Judge status: Accepted
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    x = int(input())
    ans = 8
    for i in range(400, 2000, 200):
        if i <= x <= i+199:
            break
        ans -= 1

    print(ans)

if __name__ == '__main__':
	main()
# Judge status: Wrong Answer
from sys import stdin
N,M= list(map(int,stdin.readline().strip().split()))
H=[int(x) for x in input().split()]
road=[]
hig=[]
ans=[]
kari=[]
count=[0]*N
for i in range(M):
    road.append(max(list(map(int,input().split()))))
print(len(set(road)))
# Judge status: Accepted
n,k,q=map(int,input().split())
a=[0]*q
for i in range(q):
  a[i]=int(input())
  
b=[0]*n
for i in range(q):
  b[a[i]-1]+=1
  
for i in range(n):
  if b[i]+k-q>0:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
N, Y = map(int, input().split())
a = min(Y // 10000, N) + 1
for i in range(a):
  b = min((Y - (10000 * i)) // 5000, N - i) + 1
  for j in range(b):
    if 10000 * i + 5000 * j + 1000 * (N - i - j) == Y:
      print(i, j, N - i - j)
      break
  else:
    continue
  break
else:
  print('-1 -1 -1')
# Judge status: Accepted
s, t = input().split()
a, b = map(int,input().split())
u = input()
if u == s:
    print(a-1, b)
else:
    print(a, b-1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0
# print(a)

if a.count(0)+(1 if 1 in a else 0) <= a.count(2)+1:
    print('Yes')
    exit(0)
print('No')
# Judge status: Accepted
from collections import Counter

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

bar = []
for k, v in A.items():
  bar += [k]*(v//2)
bar.sort(reverse=True)  

if len(bar) < 2:
  print(0)
else:
  print(bar[0]*bar[1])
# Judge status: Wrong Answer
import math

a,b=map(int,input().split())
if a%2==0:
    s=a*12.5
    s=math.floor(s)
    if s-b*10==5:
        print(s)
    elif b*10-s==5:
        print(b*10)
    elif b*10==s:
        print(s)
    else:
        print(-1)
else:
    t=a*12.5 +0.5
    if t-b*10==3:
        t=math.floor(t)
        print(t)

    elif b*10-t==7:
        print(b*10)
    else:
        print(-1)
# Judge status: Accepted
s = input()
t = input()


if len(s) > 10:
    print("No")
    exit()

if s != t[:-1] :
    print("No")
    exit()

alp = list('abcdefghijklmnopqrstuvwxyz')
for i in t:
    if i not in alp:
        print("No")
        exit()

print("Yes")
# Judge status: Wrong Answer
N = int(input())
S = list(input())
 
S = ''.join([chr((ord(s)+N-ord('A')%26)+ord('A')) 
             for s in S])
print(S)
# Judge status: Accepted
N = list(map(int, input().split()))
print(int((N[0] * (N[0] - 1) / 2) + (N[1] * (N[1] - 1) / 2)))
# Judge status: Wrong Answer
import numpy as np

N=int(input())
A=np.array(list(map(int,input().split())))
mod = 10**9+7

A = np.where(A >= mod, A % mod, A)

LCM = np.lcm.reduce(A)

print((LCM//A).sum() % mod)
# Judge status: Wrong Answer
N = int(input())
H = [int(i) for i in input().split()]

res = 0
cur_cnt = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    cur_cnt += 1
  else:
    if cur_cnt > res:
      res = cur_cnt
    cur_cnt = 0

print(res)
# Judge status: Accepted
def main():
    n, a, b = map(int, input().split())
    print(0 if (n == 1 and a != b) or a > b else (b - a) * (n - 1) + a - b + 1)
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
W = list()
ans = "Yes"
for i in range(n):
    w = input()
    W.append(w)
for j in range(1,n):
    if W[j][0] != W[j-1][-1] or (W[j] in W[:j]):
        ans = "No"
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
all_town = [[] for i in range(n)]
for i in range(m):
  p_y = list(map(int,input().split()))
  p_y.append(i)
  all_town[p_y[0]-1].append(p_y)

i_id = []
for town in all_town:
  town.sort(key=lambda x: x[1])
  for i in range(len(town)):
    left = "{:0=6}".format(town[i][0])
    right = "{:0=6}".format(i+1)
    i_id.append([town[i][2],left+right])
    
i_id.sort(key=lambda x: x[0])
for id in i_id:
  print(id[1])
# Judge status: Wrong Answer
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  a = x[N-i-1][1] - (x[N-i-1][0] % x[N-i-1][1])
  if ans <= a:
    ans = a
  else:
    while (x[N-i-1][0] + ans) % x[N-i-1][1] != 0:
      ans += 1
print(ans)
# Judge status: Accepted
a,b = [int(x) for x in input().split()]

ans = 0

for _ in range(2):
    if a >= b:
        ans += a
        a -= 1
    else:
        ans += b
        b -= 1

print(ans)
# Judge status: Accepted
# cook your dish here
x,k,d=map(int,input().split())
l=0
r=k
while (l<r-1):
    m=l+(r-l)//2
    if(x-k*d+2*m*d>0): r=m
    else: l=m
ans1=x-k*d+2*l*d;
ans2=x-k*d+2*r*d;
print(min(abs(ans1),abs(ans2)))
# Judge status: Accepted
a,b,c,k=map(int,input().split())
Unfair=10**18

if k==0:
    print(a-b)
    exit()
elif k%2==0:
    k=2
else:
    k=1

for i in range(k):
    a2=b+c
    b2=a+c
    c2=a+b
    a,b,c=a2,b2,c2

if a-b>Unfair:
    print("Unfair")
else:
    print(a-b)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
k = int(input())
if b<=a:
    x = 0
    for i in range(k):
        b*=2
        if a < b:
            x += (i+1)
            break
    y = 2*(k-x) if k-x > 0 else 1
else:
    y = 0
    y += k
print(['No','Yes'][b<c*y])
# Judge status: Accepted
N,c=input(),input()
print(c[:c.count('R')].count('W'))
# Judge status: Wrong Answer
N = int(input())
def func(n):
  ret = 0
  for i in range(1,int(n**0.5)+1):
    for j in range(1,int(n**0.5)+1):
      for k in range(1,int(n**0.5)+1):
        if (i+j)**2+(j+k)**2+(k+i)**2 == 2*n:
          ret += 1
  return ret
for i in range(1,N):
  print(func(i))
# Judge status: Accepted
S=input()
if S =="ABC":
  print("ARC")
  
elif S=="ARC":
  print("ABC")
# Judge status: Accepted
D = int(input())

if D ==25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve") 
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")
# Judge status: Accepted
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
L = [0] * (N+1)
for a in A:
    L[a] += 1
for l in L[1:]:
    print("Yes" if Q-l < K else "No")
# Judge status: Accepted
X = int(input())

while(True):
    for i in range(2, X):
        if(X % i == 0):
            break
    else:
        print(X)
        break
    X += 1
# Judge status: Accepted
x,n,*p = map(int,open(0).read().split())
a = [[i,abs(x-i)] for i in range(0,102) if i not in p ]
a.sort(key=lambda x:x[1]) 
print(a[0][0])
# Judge status: Wrong Answer
from decimal import *
a=input().split()
A=int(a[0])
B=int(a[1].replace(".",""))
#B_int=int(B)
#B_float=int(B)*100-int(B)*100
#print(A,B)

ans=int(A)*int(B)//100
#print(A*B_int,(A*B_float)//100)
print(ans)
# Judge status: Accepted
from statistics import median

n = int(input())
x_min = []
x_max = []
for _ in range(n):
    a, b = map(int, input().split())
    x_min.append(min(a, b))
    x_max.append(max(a, b))

print(int((median(x_max)-median(x_min))*2)+1 if n % 2 == 0 else median(x_max)-median(x_min)+1)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1

for i in A:
    answer = answer * i
    if i == 0:
        print(0)
        break
    if answer > 10 **18:
        print(-1)
        break
else:
        print(answer)