peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x, y = list(map(int, input().split()))
g0, g1, g2 = [1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2, ]
def num_group(a):
    if a in g0: return 0
    if a in g1: return 1
    if a in g2: return 2
if num_group(x) == num_group(y):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from bisect import bisect_left 
n,m = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(m)]
#print(l)
k = [[] for i in range(n)]
for j,h in l:
  k[j-1].append(h)
k_so = [[] for i in range(n)]
for i in range(n):
  a = k[i]
  k_so[i] = sorted(a)
#print(k_so)
for j,h in l:
  first = "{:0=6}".format(j)
  t = bisect_left(k_so[j-1], h)
  second = "{:0=6}".format(t+1)
  print(first+second)
# Judge status: Wrong Answer
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z > 0 and z<=k:
            ans += 1 
print(ans)
# Judge status: Accepted
S,T = map(str,input().split())
print(T + S)
# Judge status: Accepted
n=int(input())

def dfs(s,mx):
    if len(s)==n:
        print(s)
        return
    for c in range(ord('a'),mx+2):
        t=s
        t+=chr(c)
        dfs(t,max(mx,c))

dfs("",ord('a')-1)
# Judge status: Wrong Answer
N = int(input())
W = list(map(int, input().split()))

total = sum(W)
half = total / 2
#print(total, half)

cumul = 0
for w in W:
  cumul += w
  #print(cumul)
  if cumul >= half:
    break

ans = abs(total - 2 * cumul)
print(ans)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
s = input()
maxa = a+b
maxb = b
counta = 0
countb = 0
for i in range(n):
  if s[i] == 'c':
    print("No")
  elif s[i] == 'b':
    if countb < maxb and counta < maxa:
      print("Yes")
    else:
      print("No")
    counta += 1
    countb += 1
  else:
    if counta < maxa:
      print("Yes")
    else:
      print("No")
    counta+=1
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
k=int(input())
print(max(a,b,c)*(2*k)+(a+b+c-max(a,b,c)))
# Judge status: Accepted
n,m = list(map(int,input().strip().split()))

path = [[] for i in range(n)]

for i in range(m):
  a,b = list(map(int,input().split()))
  path[a-1].append(b-1)
  path[b-1].append(a-1)

for j in path[0]:
  if n-1 in path[j]:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")
# Judge status: Accepted
n = int(input())

A = []
B = []

for i in range(n):
   a, b = map(int, input().split())
   A.append(a)
   B.append(b)

A.sort()
B.sort()

ans = 0

if n % 2 == 1:
    l1 = A[int(n/2)]
    r1 = B[int(n/2)]
    ans = r1 - l1 + 1
else:
    l2 = A[int(n/2)-1] + A[int((n/2))]
    r2 = B[int(n/2)-1] + B[int((n/2))]
    ans = r2 - l2 + 1

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    A, B, C, X, Y = map(int, open(0).read().split())
    
    S = []
    for i in range(0, 2*max(X, Y)+1):
        S.append(A*max(0, X - i//2) + B*max(0, Y - i//2) + C*i)
    print(min(S))

main()
# Judge status: Accepted
import collections

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

s_counter = collections.Counter(s)
t_counter = collections.Counter(t)
t_keys = list(t_counter.keys())
ans = []

for key in s_counter.keys():
    if key in t_keys:
        ans.append(int(s_counter[key]) - int(t_counter[key]))
    else:
        ans.append(s_counter[key])
max_ans = max(ans)
if max_ans < 0:
    print(0)
else:
    print(max_ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

A.sort()

edge = [0] * 2
for i in range(2):
    while True:
        l = len(A)
        if len(A) < 2:
            print(0)
            exit(0)

        if A[l-2] == A[l-1]:
            edge[i] = A.pop()
            A.pop()
            break

        A.pop()

print(edge[0] * edge[1])
# Judge status: Accepted


s = input()
x = s.split()

ans = x[0][0] + x[1][0] + x[2][0]

print(ans)
# Judge status: Wrong Answer
n,d = map(int,input().split())
print((n+d+4-1)//(d+4))
# Judge status: Accepted
n, m = map(int, input().split())
SC = [tuple(map(int, input().split())) for i in range(m)]
if n == 1:
	r = range(0, 10)
elif n == 2:
	r = range(10, 100)
else:
	r = range(100, 1000)
for i in r:
	si = str(i)
	for s, c in SC:
		if si[s-1] != str(c):
			break
	else:
		print(i)
		exit()
else:
	print(-1)
# Judge status: Wrong Answer
s = input()
a = s.count('a')
b = s.count('b')
c = s.count('c')

ans = ''
if a == b == c - 1:
  ans = 'YES'
elif a == b - 1 == c:
  ans = 'YES'
elif a - 1 == b == c:
  ans = 'YES'
if a == b == c + 1:
  ans = 'YES'
elif a == b + 1 == c:
  ans = 'YES'
elif a + 1 == b == c:
  ans = 'YES'
else:
  ans = 'NO'
print(ans)
# Judge status: Accepted
import bisect
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.insert(0, 0)
B.insert(0, 0)
for i in range(1, N+1):
    A[i] += A[i-1]
for i in range(1, M+1):
    B[i] += B[i-1]
ans = 0
for i in range(N+1):
    sub = 0
    if A[i] <= K:
        sub += i
        sub += bisect.bisect_right(B, K-A[i])-1
    ans = max(sub, ans)
print(ans)
# Judge status: Accepted
def gcd(a,b):
    # assume a,b are +ve integers.
    if a>b:
        a,b = b,a
    if b%a==0:
        return a
    
    return gcd(a,b%a)
print(360//(gcd(360,int(input()))))
# Judge status: Accepted
a = int(input())
b = int(input())
if a%500 <= b :
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import numpy as np

S = input()
T = input()

m = len(S)
n = len(T)

for i in range(m-n, -1, -1):
  if np.prod([s in [t, '?'] for s, t in zip(S[i:i+m], T)]):
    ans = S[:i] + T + S[i+m:]
    ans = ans.replace('?', 'a')
    break
else:
  ans = 'UNRESTORABLE'
print(ans)
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
ac = Counter(A)
ans = 0
for i in range(2,max(A)):
    if i-1 in ac and i in ac and i+1 in ac:
        ans = max(ans,ac[i-1]+ac[i]+ac[i+1])
print(ans)
# Judge status: Wrong Answer
A, B, C, X, Y = map(int, input().split())

if X >= Y:
    print(C*2*Y + A*(X-Y))
else:
    print(C*2*X + A*(Y-X))
# Judge status: Wrong Answer
import sys
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
    print(0)
    sys.exit()
s=max(a,b,c)
t=a*b*c/s
d=int(s//2)+1
ch=s-d
ans=int((d-ch)*t)
print(ans)
# Judge status: Wrong Answer
N, M = [int(i) for i in input().split()]

L = abs(N - M)

if L >= 2:
    print(0)
# Judge status: Accepted
o = input()
e = input()
answer = ""
for id in range(len(o)):
    answer += o[id]
    if len(e) > id: answer += e[id]
print(answer)
# Judge status: Accepted
n,h,*L=map(int,open(x:=0).read().split());a=max(L[::2]);B=sorted([l for l in L[1::2] if l>a])
for b in B[::-1]:
  h-=b
  x+=1
  if h<1:break
print(x-min(0,-h//a))
# Judge status: Accepted
N, T = map(int, input().split())

judge = False
cost = list()
for a in range(N):
    c, t = map(int, input().split())
    if t <= T:
        cost.append(c)
        judge = True

if judge:
    print(min(cost))
else:
    print('TLE')
# Judge status: Wrong Answer
N,M = [int(i) for i in input().split()]
if M % 2 == 1:
    m = (M-1)//2 - N
else :
    m = M//2 - N
print(N+ m//2)
# Judge status: Accepted
s = input()
l =[]
for i in range(0,len(s)-2):
    l.append(abs(753-int(s[i:i+3])))
# print(l)
print(min(l))
# Judge status: Accepted
a=sorted(input())
b=sorted(input())[::-1]
print("Yes" if a<b else "No")
# Judge status: Accepted
N, M = map(int, input().split())
answer = 0
if N == 1 and M == 1:
    answer = 1
elif N == 1 and M != 1:
    answer = max(0, M-2)
elif N != 1 and M == 1:
    answer = max(0, N-2)
elif M >= 2 and N >= 2:
    answer = (M-2) * (N-2)

print(answer)
# Judge status: Accepted
S = input()
result = 'Yes'

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == 'L':
            result = 'No'
    elif i % 2 == 1:
        if S[i] == 'R':
            result = 'No'
print(result)
# Judge status: Accepted
N,K = map(int, input().split())
H = list(map(int, input().split()))

list.sort(H, reverse=True)
for i in range(N):
    if i<=K-1:
        H[i] = 0

print(sum(H))
# Judge status: Accepted
k, n = map(int, input().split())
a = list(map(int, input().split()))
d = a[0]+k-a[n-1]
for i in range(n-1):
    t = a[i+1] - a[i]
    d = max(t, d)
print(k-d)
# Judge status: Wrong Answer
N, K = map(int, input().split())

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

L = [0]*N

for k in range(K):
  for n in range(N):
    a = A[n]
    for i in range(2*a+1):
      p = n - a + i
      if 0 <= p < N:
        L[p] += 1
  A = L
  L = [0]*N

print(A)
# Judge status: Accepted
k,s=map(int,input().split())
ans=0
for a in range(k+1):
  for b in range(k+1):
    if 0<=s-a-b<=k:
      ans+=1
print(ans)
# Judge status: Accepted
def gcda(a,b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcda(r, b)

def lcm(a,b):
    return a*b//gcda(a,b)

X=int(input())
shukai=360
while True:
    if shukai%X==0:
        print(shukai//X)
        exit()
    else:
        shukai=lcm(shukai,X)
# Judge status: Accepted
x = int(input())
ans = 0
if x >= 500:
  ans += (x//500) * 1000
  x %= 500
if x >= 5:
  ans += (x//5) * 5
print(ans)
# Judge status: Accepted
import collections

N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
M=collections.Counter(L)
M=sorted(M.items())
ans=max(M[i][1] for i in range(len(M)))
if len(M)==2:
	if M[0][0]+1==M[1][0] or M[0][0]+2==M[1][0]:
		ans=M[0][1]+M[1][1]
for i in range(1,len(M)-1):
	tmp=0
	tmp+=M[i][1]
	if M[i-1][0]==M[i][0]-1:
		tmp+=M[i-1][1]
	if M[i+1][0]==M[i][0]+1:
		tmp+=M[i+1][1]
	ans=max(ans,tmp)
print(ans)
# Judge status: Accepted
import math
N = int(input())
sqt = int(math.sqrt(N))
for x in range(sqt,0,-1):
    if N % x == 0:
        y = N // x
        ans = x + y - 2
        break
print(ans)
# Judge status: Wrong Answer
N = int(input())
AB = [list(map(int,input().split())) for i in range(N)]

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

import sys
work = 0

for i in range(N):
    work += AB[i][0]
    if work > sortedAB[i][1]:
        print('No')
        sys.exit()
        
print('Yes')
# Judge status: Accepted
arr = input().split()
x = int(arr[0])
a = int(arr[1])
b = int(arr[2])

if b <= a:
    print('delicious')
elif b - a <= x:
    print('safe')
elif b - a >= x + 1:
    print('dangerous')
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n - 1):
    if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
        cnt += 1

print(cnt)
# Judge status: Accepted
S = input().replace('eraser', '!').replace('erase', '!').replace('dreamer', '!').replace('dream', '!').replace('!', '')
if len(S) == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n, x, y = [int(i) for i in input().split()]

ans = [0]*n
for i in range(n-1):
    for j in range(i+1, n):
        ans[min(j-i, (abs(x-i) + abs(j-y) + 1))] += 1

print(*ans[1:], sep='\n')
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
c=[0]*3
for a in A:
    if a%2!=0:
        c[0]+=1
    elif a%4==0:
        c[2]+=1
    else:
        c[1]+=1

if c[2]<c[0]-1:
    print("No")
else:
    c[2]-=(c[0]-1)
    if c[1]==0:
        print("Yes")
    else:
        if c[2]>0:
            print("Yes")
        else:
            print("No")
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
c = 0
for i in A:
    x -= i
    if x >= 0:
        c += 1
    else:
        break

if x > 0:
    c -= 1

print(c)
# Judge status: Wrong Answer
N = int(input())
I_1 = [0]
I_1.append(list(map(int,input().split())))
I_2 = [0]
I_2.append(list(map(int,input().split())))
print(I_1)
print(I_2)
# Judge status: Wrong Answer
n, k = map(int, input().split())
print((100**n)*k)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
C - Lower
https://atcoder.jp/contests/abc139/tasks/abc139_c

"""
import sys


def solve(N, numbers):
    dp = {-1: 0}
    for i, a, b in zip(range(N), numbers, numbers[1:]):
        dp[i] = (dp[i-1] + 1) if b <= a else 0
    return max(dp.values())


def main(args):
    N = int(input())
    numbers = [int(h) for h in input().split()]
    ans = solve(N, numbers)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
# Judge status: Accepted
N = int(input())

for i in range(1, 10):
    if N % i == 0 and N // i <= 9:
        print("Yes")
        break
else:
    print("No")
# Judge status: Accepted
O = input()
E = input()

s=''
for i in range(len(O)):
  s += O[i]
  if i < len(E):
    s+= E[i]
print(s)
# Judge status: Accepted
sx, sy, tx, ty = map(int,input().split())
x = tx-sx
y = ty-sy
print('U'*y + 'R'*x + 'D'*y + 'L'*x + 'D' + 'R'*(x+1) + 'U'*(y+1) + 'L' + 'U' + 'L'*(x+1) + 'D'*(y+1) + 'R')
# Judge status: Accepted
import math
N = int(input())
A = list(map(int,input().split()))

four = 0
two = 0

for i in range(len(A)):
  if A[i]%4 == 0:
    four += 1
  if A[i]%2 == 0:
    two += 1
n = math.floor(N/2)
two -= four
x = (n - four) * 2

# print(four, two, n, x)
if four >= n:
  print("Yes")
elif two >= x:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]
sort_a = sorted(a, reverse=True)
amax = sort_a[0]
asecond = sort_a[1]
for i in range(n):
    tmp = a[i]
    if tmp == amax:
        print(asecond)
    else:
        print(amax)
# Judge status: Wrong Answer
N = int(input())
a_list = list(map(int,input().split()))

a_list.sort(reverse=True)

sum = 0
for i in range(N, 2*N, 1):
    sum += a_list[i]

print(sum)
# Judge status: Accepted
n,x=[int(i) for i in input().split()]

a_list=[int(i) for i in input().split()]

a_list.sort()

if x>sum(a_list):
    print(n-1)

#全員喜ぶ    
elif x==sum(a_list):
    print(n)
    
else:
    sum=0
    count=0
    for i in range(n):
        sum+=a_list[i]
        if sum<=x:
            count+=1
        else:
            break
    print(count)
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))

arr = [0] * 200000
for i in range(len(a)):
    arr[a[i]] += 1

arr.sort()
arr.reverse()

s = 0
for i in range(k):
    s += arr[i]
    
print(n-s)
# Judge status: Accepted
N = int(input())

state = 0
for i in range(1,10):
  for j in range(1,10):
    if(i * j == N):
      state = 1

if state == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
k,x=[int(j) for j in input().split()]
if 500*k>=x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = []
B = []
for _ in range(M):
    L,R = map(int,input().split())
    A.append(L)
    B.append(R)
print(min(B)-max(A)+1)
# Judge status: Accepted
a,b = map(float,input().split())
for i in range(10000):
  c = i*8//100
  d = i*10//100
  if(a == c and b == d):
    print(i)
    exit()
print(-1)
# Judge status: Accepted
n,a,b=map(int,input().split())
answer=0
for i in range(1,n+1):
   if a<=sum(map(int,str(i)))<=b:
      answer=answer+i
print(answer)
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

l = p[:x] + q[:y] + r
l.sort(reverse=True)

print(sum(l[:x+y]))
# Judge status: Accepted
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]
dp = []

for i in range(n):
    if i == 0:
        dp.append([abc[0][0], abc[0][1], abc[0][2]])
        continue
    dp.append([max(dp[i-1][1]+abc[i][0], dp[i-1][2]+abc[i][0]), max(dp[i-1][2]+abc[i][1], dp[i-1][0]+abc[i][1]), max(dp[i-1][0]+abc[i][2], dp[i-1][1]+abc[i][2])])

print(max(dp[-1]))
# Judge status: Wrong Answer
n, m = map(int, input().split())
red = [0]*n
ball = [1]*n
red[0] = 1
for i in range(m):
    x, y = map(int, input().split())
    if red[x-1] == 1:
        red[y-1] = 1
        if ball[x-1] == 1:
            red[x-1] = 0
        ball[y-1] += 1
        ball[x-1] -= 1
print(sum(red))
# Judge status: Wrong Answer
n = int(input())

for i in range(int(n**0.5)+10):
    tmp = n
    now = i*(i+1)//2
    tmp -= now
    if tmp < i:
        break

for j in range(1,i):
    print(j)
    
print(n-(i-1)*i//2)
# Judge status: Accepted
N,M=map(int,input().split())
if N >= M//2:
    print(M//2)
    exit()
ans = N
rest_c = M - N*2
ans += rest_c // 4
print(ans)
# Judge status: Accepted
N,A,B=map(int,input().split())

D=B-A

if D%2:
    a=A-1
    b=N-B
    print(min(a,b)+1+(D-1)//2)
else:
    print(D//2)
# Judge status: Wrong Answer
S = ["ABC", "ARC"]
if S == S[1]:
  print(S[0])
elif S == S[0]:
  print(S[1])
else:
  print("")
# Judge status: Accepted
n = int(input())
sum = 0
skip = -1
for i in range(1,n+1):
    sum += i
    if sum >= n:
        skip = sum - n # 超過分 skip <= n
        last = i
        break
for i in range(1,last+1):
    if i == skip:
        continue
    else:
        print(i)
# Judge status: Wrong Answer
import collections
n = int(input())
num_list = list(map(int, input().split()))
all = 0

c = collections.Counter(num_list)
value_list = list(c.values())

for i in range(len(value_list)):
    if not value_list[i] == 1:
        all += value_list[i]*value_list[i-1]//2

for k in range(n):
    print(all - c[num_list[k]]-1)
# Judge status: Accepted
import sys

A, B, C, D = list(input())

op = ["+", "-"]

for i in range(2):
    for j in range(2):
        for k in range(2):
            f = A + op[i] + B + op[j] + C + op[k] + D
            # print(f)
            if eval(f) == 7:
                print(f, "=7", sep="")
                sys.exit()
# Judge status: Accepted
w, a, b = map(int, input().split())
if a <= b <= a+w:
    print(0)
else:
    print(min(abs(b-a-w), abs(a-b-w)))
# Judge status: Accepted
import math

def main(x):
    if x == 2:
        return 2
    res = x
    while(1):
        if isSosuu(res):
            return res
        res += 1

def isSosuu(val):
    div = math.ceil(math.sqrt(val))
    for i in range(2,div+1):
        if val%i == 0:
            return False
    return True

x = int(input())
print(main(x))
# Judge status: Wrong Answer
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n = int(stdin.readline().rstrip())
s = [stdin.readline().rstrip() for _ in range(n)]

final = s[0]
for i in s[1:]:
    for j in final:
        if j not in i:
            final = final.replace(j,"")
final = list(final)
final.sort()

print("".join(final))
# Judge status: Accepted
A,B,C=map(int,input().split())

if A+B>=C:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
res = [int()]*n
for i in range(n):
    res[i] = a[i] - i - 1
res.sort()
if n % 2 == 0:
    x = res[int(n/2)] + res[int(n/2)-1]
else:
    x = res[int(n/2)]
for j in range(n):
    res[j] = abs(res[j] - x)
print(sum(res))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
if N > M: N, M = M, N
if N == 2: print(0)
elif N == 1 and (M == 2): print(2)
elif N == 1: print(max(0, M - 2))
else: print(max(0, (N - 2) * (M - 2)))
# Judge status: Accepted
import sys
a,b,c,d=map(int,input().split())
if abs(a-c)<=d:
  print("Yes")
  sys.exit()
elif abs(a-b)<=d and abs(b-c)<=d:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,A,B,C,D = map(int,input().split())
S = input()

goal = max(C,D)
if '##' in S[A-1:goal]:
  print("No")
  exit()

ok = True
# 追い越す必要がある
if D < C:
  # 間に3マスあきがない or B,Dの間に3マス空きがない
  if ('...' in S[B-1:D]) or ('...' in S[B-2:B+1]) or ('...' in S[D-2:D+1]):
    ok = True
  else:
    ok = False
# 必要がない場合は問題ない

if ok:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from functools import reduce
from math import gcd

n, x = map(int, input().split())
a = [abs(int(A) - x) for A in input().split()]
a.sort()
print(a)
print(reduce(gcd, a))
# Judge status: Accepted
a, b = map(int, input().split())
if a==b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for h in range(a +1):
    for i in range(b +1):
        for j in range(c +1):
            total = a *500 + b *100 + c *50
            if total == x:
                count += 1
print(count)
# Judge status: Wrong Answer
from fractions import gcd
N = int(input())
if N >2:
    A = [int(input()) for _ in range(N)]
    B = [0]*(N-1)
    B[0] = (A[0]*A[1])//gcd(A[0], A[1])
    for i in range(N-2):
        B[i+1] = (A[i+2]*B[i])//gcd(A[i+2], B[i])
    ans = B[N-2]
else:
    ans = int(input())
print(ans)
# Judge status: Wrong Answer
s=input()
print(s.replace("?","P"))
# Judge status: Wrong Answer
import numpy as np

D = int(input())
c = list(map(int, input().split()))
c = np.array(c)
S = np.zeros([D, 26], dtype=int)
for i in range(D):
  S[i, :] = list(map(int, input().split()))

T = []
last = np.zeros(26)

for i in range(D):
  score = S[i, :] - (i-last)*np.array(c)
  argmax = score.argmax()
  t = argmax
  last[t] = i
  print(t)
# Judge status: Accepted
n, a, b = map(int, input().split())
sums = 0
for i in range(n+1):
    if len(str(i)) != 1:
        nlist = [int(j) for j in str(i)]
        s = 0
        for num in nlist:
            s += num
    else:
        s = int(i)
    if a <= s <= b:
        sums += i
print(sums)
# Judge status: Accepted
N=int(input())
items = [int(input()) for i in range(N)]
tot=sum(items)
ans=0
if tot%10!=0:
  ans=tot
else:
  items.sort()
  for i in range(N):
    if items[i]%10!=0:
      ans=tot-items[i]
      break
print(ans)
# Judge status: Accepted
K = int(input())

A, B = map(int, input().split())

flag = False
for x in range(A, B+1):
  if x % K == 0:
    flag = True


if flag:
  print("OK")
else: 
  print("NG")
# Judge status: Accepted
x, y, z = [int(a) for a in input().split()]
if y*z>=x:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n,k,q= list(map(int, input().split()))
lis=[k]*n
for i in range(q):
    a=int(input())
    a-=1
    lis=list(map(lambda x: x-1, lis))
    
for i in range(n):
    if lis[i]>0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n=list(input())
le=len(n)
if le==1:
  print(int(n[0]))
  exit()
x=list(n)
x.remove(x[0])
if len(set(x))==1 and x[0]=='9':
  key=int(n[0])
  print(9*(le-1)+key)
  exit()
m=list(n)
m.remove(m[-1])
if len(set(m))==1 and m[0]=='9':
  print(9*(le-1)+8)
else:
  key=int(n[0])
  print(9*(le-1)+key-1)
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())

ans = 'NG'

for i in range(a, b+1):
    if i % k == 0:
        ans = 'OK'

print(ans)
# Judge status: Accepted
import math

r = int(input())

result = 2 * r * math.pi

print(result)
# Judge status: Wrong Answer
N,K = map(int,input().split())
h = [0]*N
for i in range(N):
    h[i] = int(input())
h = sorted(h)
ans = 10**10
for i in range(N-2):
    tmp = h[i+2] - h[i]
    ans = min(tmp,ans)
print(ans)
# Judge status: Accepted
def main():
    A, B, N = map(int, input().split())

    x = min(B - 1, N)

    ans = (A * x // B) - A * (x // B)
    print(ans)


if __name__ == '__main__':
    main()

# editorial
# f(x)=(A * x // B) - A * (x // B)
# f(x+B)==f(x)
# 周期性があるので
# 0<=x<Bの場合を考えればよい
# (A * x // B)は広義単調増加
# A * (x // B) == 0
# 定義域で最大のx=min(B-1,N)のとき最大になる
# Judge status: Accepted
N = int(input())
h = list(map(int, input().split()))

if N == 2:
  print(abs(h[1]-h[0]))
  exit()

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

print(dp[N-1])
# Judge status: Accepted
n, l = list(map(int, input().split()))

list_of_words = []

for _ in range(n):
    s = input()
    list_of_words.append(s)

list_of_words.sort()

answer = ""
for word in list_of_words:
    answer += word

print(answer)
# Judge status: Wrong Answer
N = int(input())
W = list(map(int,input().split()))
weight= sum(W)
cnt = 0
for i in range(N):
  weight -= W[i]
  cnt += W[i]
  if weight <= cnt:
    print(cnt-weight)
    exit()
# Judge status: Wrong Answer
n = int(input())
a_ls = list(map(int, input().split()))
times = 0
i = 0
while i+2 < n:
    if a_ls[i] < a_ls[i+1] > a_ls[i+2] or a_ls[i] > a_ls[i+1] < a_ls[i+2]:
        times += 1
        i += 1
    i += 1
print(times+1)
# Judge status: Wrong Answer
import math
a = int(input())

print(a*math.pi)
# Judge status: Accepted
s=input()
Acnt=[];Zcnt=[]
for i in range(len(s)):
    if(s[i]=='A'):
        Acnt.append(i)
    elif(s[i]=='Z'):
        Zcnt.append(i)
print(Zcnt[-1]-Acnt[0]+1)