peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a,b = map(int,input().split())

if a >= 13:
    print(b)
elif a >= 6:
    print(b/2)
else:
    print(0)
# Judge status: Wrong Answer
import math
S=int(input())
count = 1
if S>3:
    i=1
    while S>3*(i+1):
        count += math.factorial(S-3*(i+1)+i)//(math.factorial(S-3*(i+1))*math.factorial(i))
        i+=1
    print(count%1000000007)
else:
    print(0)
# Judge status: Accepted
W,H,N=map(int,input().split())
A=[]
right=W
left=0
top=H
under=0

for i in range(N):
  A.append(list(map(int,input().split())))
  if A[i][2]==1:
    if left<A[i][0]:
      left=A[i][0]
  if A[i][2]==2:
    if right>A[i][0]:
      right=A[i][0]
  if A[i][2]==3:
    if under<A[i][1]:
      under=A[i][1]
  if A[i][2]==4:
    if top>A[i][1]:
      top=A[i][1]

print(max(0,top-under)*max(0,right-left))
# Judge status: Wrong Answer
from sys import stdin

N = int(stdin.readline().strip())
min_a = float("inf")
min_s = (0,0)
max_a = 0
max_s = (0,0)
for _ in range(N):
    x,y = map(int,stdin.readline().strip().split())
    manhat = x+y
    if manhat < min_a:
        min_s = (x,y)
        min_a = manhat
    elif manhat > max_a:
        max_a = manhat
        max_s = (x,y)
print(abs(max_s[0]-min_s[0])+abs(max_s[1]-min_s[1]))
# Judge status: Wrong Answer
N = int(input())
A = int(input())

print('Yes' if N%500 < A else 'No')
# Judge status: Wrong Answer
N=input()
A=map(int,input().split())
B=list(map(abs,A))
print(sum(B)-min(B)*(1-(-1)**sum([1 for i in A if i<0])))
# Judge status: Wrong Answer
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()+[0]

money=1000
ans=1000
kabu=0

for i in range(n):
  if a[i]<a[i+1]:
    kabu+=money//a[i]
    money-=kabu*a[i]
  elif a[i]>a[i+1]:
    money+=kabu*a[i]
    kabu=0

  ans=max(ans,money)

print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
ok=max(a)
ng=0
while ok-ng>1:
    mid=(ok+ng)//2
    cnt=0
    for i in range(n):
        num=a[i]
        cnt+=-(-num//mid)-1
    if cnt<=k:
        ok=mid
    else:
        ng=mid
print(ok)
# Judge status: Accepted
X = int(input())
Y = X % 100
Z = X // 100
if 5*Z >= Y or Z>=20:
    print(1)
else:
    print(0)
# Judge status: Accepted
A = list(map(int, input().split()))

print(str(min(A))*max(A))
# Judge status: Accepted
si = "" + input()
count = 0
for i in range(len(si)):
  if ( si[i] == '1'):
    count += 1
print(count)
# Judge status: Accepted
a,b,c = map(int, input().split())

print(int(a*b/2))
# Judge status: Accepted
import heapq as hp
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=[-x for x in a]
hp.heapify(a)

for i in range(m):
    t=hp.heappop(a)
    hp.heappush(a,-(-t//2))

print(-sum(a))
# Judge status: Accepted
if input() == "ABC":
	print("ARC")
else:
	print("ABC")
# Judge status: Wrong Answer
import bisect
import math
n,h = map(int, input().split())
a_list = []
b_list = []
for i in range(n):
    a,b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
b_list.sort()
ans = 0
index = bisect.bisect_left(b_list, a_list[n-1])
for j in b_list[index:][::-1]:
    ans += 1
    h -= j
    if h <=0:
        break
print(ans+ math.ceil(h/a_list[n-1]))
# Judge status: Accepted
a, b, c = map(int,input().split())

s = a*b//2

print(s)
# Judge status: Accepted
li = [int(x) for x in input().split()]
li.sort()
print(li[0] + li[1])
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]

ans = 0
minus_cnt = 0
min_abs = float("inf")
for a in A:
    if a < 0:
        minus_cnt += 1
    ans += abs(a)
    min_abs = min(min_abs, abs(a))

if minus_cnt % 2 == 0:
    print(ans)
else:
    print(ans - min_abs * 2)
# Judge status: Wrong Answer
from collections import Counter as cnt
b = cnt([input() for _ in range(int(input()))])
r = cnt([input() for _ in range(int(input()))])
a = -10**3
for l in b.keys(): a = max(a,b[l]-r[l])
for l in r.keys(): a = max(a,b[l]-r[l])
print(a)
# Judge status: Accepted
a,b,c=input().split()
num=int(a+b+c)
if num%4==0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
num = list(input())

jadge = ""

for i in range(len(num) - 1):
  if num[i] != num[i + 1]:
    jadge = "Good"
    continue
  else:
    jadge = "Bad"
    break

print(jadge)
# Judge status: Accepted
A,B,K = map(int,input().split())
cnt = 0
for i in reversed(range(1,min(A,B)+1)):
    if(A%i== 0 and B%i == 0):
        cnt += 1
    if(cnt == K):
        print(i)
        break
# Judge status: Accepted
n, m = map(int, input().split())
if n >= m:
    print(m//2)
else:
    s = (m-n*2)//4
    print(s+n)
# Judge status: Accepted
#!/usr/bin/env python3
K, N = [int(str) for str in input().strip().split()]
A = [int(str) for str in input().strip().split()]

diffs = []
for i in range(N - 1):
    diffs.append(A[i + 1] - A[i])
diffs.append(K - A[-1] + A[0])

print(K - max(diffs))
# Judge status: Wrong Answer
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()
print(min(a,b))
# Judge status: Accepted

def Postal_Code(a , b , s):

    ans = "No"

    if s[:a].isdecimal() and s[a+1:].isdecimal() and s[a] == '-':
        ans = "Yes"

    return ans

def main():
    a , b = map(int , input().split())
    s = str(input())
    print(Postal_Code(a , b , s))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = (int(x) for x in input().split())
if a > 0:
    print('Positive')
if a <= 0 and b >= 0:
    print('Zero')
else:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
# Judge status: Accepted
def dfs(A: list):
    if len(A) > nn:
        return
    if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
        ans[0] = x
        return

    for v in d:
        if v == "0" and len(A) == 0:
            next
        A.append(v)
        dfs(A)
        A.pop()


n, k = map(int, input().split())
d = sorted(list(set([str(i) for i in range(10)]) - set(input().split())))
nn = len(str(n))+1
ans = [10**7]
dfs([])
print(ans[0])
# Judge status: Accepted
#!/usr/bin/env python3

k,x = map(int,input().split())
if 500*k >= x:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
mul2019 = []
for i in range(2, 100):
    if str(i*2019).count("0")>0:
        continue
    mul2019.append(str(i*2019))
import re
n = str(input())
cnt = 0
for j in mul2019:
    cnt += len(re.findall(j, n))
print(cnt)
# Judge status: Accepted
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()

ans = ["a"]
for i in range(N-1):
    nans = []

    for S in ans:
        m = max(S)
        for x in range(ord(m)-95):
            nans.append(S+chr(97+x))

    ans = copy.copy(nans)

print("\n".join(ans))
# Judge status: Accepted
n, m = list(map(int, input().split()))
b = [["W", 1] for _ in range(n)]
b[0] = ["R", 1]

for i in range(m):
    x, y = list(map(int, input().split()))

    b[x-1][1] -= 1
    if b[x-1][0] == "R":
        b[y-1] = ["R", b[y-1][1]+1]

        if b[x-1][1] == 0:
            b[x-1][0] = "W"
    else:
        b[y-1][1] += 1

cnt = 0
for i in range(n):
    if b[i][0] == "R":
        cnt += 1

print(cnt)
# Judge status: Accepted
import math

n = int(input())
s = input()
ex = 0

for i in range(n-2):
  for x in range(1, int(math.ceil((n-i)/2))):
    if s[i] != s[i+x] and s[i] != s[i+2*x] and s[i+x] != s[i+2*x]:
      ex += 1

print(s.count("R") * s.count("G") * s.count("B")-ex)
# Judge status: Accepted
n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort()

ans = 0
for i in range(n):
    ans += l[i][0] * min(m, l[i][1])
    m -= l[i][1]
    if m <= 0:
        break

print(ans)
# Judge status: Accepted
N = int(input())
CSF = [map(int, input().split()) for _ in range(N-1)]
C, S, F = [list(i) for i in zip(*CSF)]

for i in range(N):
    if i == N-1:
        print(0)
    else:
        t = S[i]
        for j in range(N-i-1):
            t = max(((t+F[i+j]-1)//F[i+j])*F[i+j], S[i+j])+C[i+j]
        print(t)
# Judge status: Accepted
import fractions
n=int(input())
t=[int(input()) for i in range(n)]
lcm=1
for i in range(n):
  lcm=(lcm*t[i])//(fractions.gcd(lcm,t[i]))
print(lcm)
# Judge status: Accepted
x, k ,d = map(int, input().split())

if abs(x) > k*d:
    print(abs(x)-k*d)
else:
    t = abs(x)%d
    s = (abs(x)-t)//d
    if (k-s) % 2 == 1:
        print(abs(t-d))
    else:
        print(t)
# Judge status: Wrong Answer
n, m = map(int, input().split())

if n == 1 or m == 1:
    n, m = sorted([n, m])
    print(max(n*m-2, 0))
else:
    print(n*m-2*(n+m)+4)
# Judge status: Accepted
a, v = map(int, input().strip().split())
b, w = map(int, input().strip().split())
t = int(input().strip())

if w>=v or t<abs(a-b)/(v-w):
    print("NO")
else:
    print("YES")
# Judge status: Accepted
N, R = map(int, input().split())

if N >= 10:
    print(R)
else:
    r = R + 100 * (10 - N)
    print(int(r))
# Judge status: Accepted
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
cnt=defaultdict(lambda :0)

for i in range(n):
    for j in range(-1,2):
        cnt[a[i]+j]+=1

print(max(cnt.values()))
# Judge status: Accepted
N,M=map(int,input().split())
A=list(map(int,input().split()))

count=0
for i in range(N):
    if A[i]>=(sum(A)*1/4/M):
        count+=1

if count>=M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3


def solve(C: str):
    return chr(ord(C) + 1)


def main():
    C = input().strip()
    answer = solve(C)
    print(answer)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
hn = list(map(int, input().split()))
dp = [float('inf') for _ in range(n)]
dp[0] = 0
dp[1] = abs(hn[1] - hn[0])
for i in range(2, n):
    dp[i] = min(
        dp[i],
        dp[i-1] + abs(hn[i-1] - hn[i]),
        dp[i-2] + abs(hn[i-2] - hn[i])
        )
print(dp[n-1])
# Judge status: Accepted
n=int(input())
L=[0,0,0,0]
x = [input() for i in range(n)]

for i in range(n):

  if x[i]=='AC':
    L[0]=L[0]+1
  elif x[i]=='WA':
    L[1]=L[1]+1
  elif x[i]=='TLE':
    L[2]=L[2]+1
  else:
    L[3]=L[3]+1


print('AC'+' x '+str(L[0]))
print('WA'+' x '+str(L[1]))
print('TLE'+' x '+str(L[2]))
print('RE'+' x '+str(L[3]))
# Judge status: Accepted
print("vowel") if input() in ["a", "i", "u", "e", "o"] else print("consonant")
# Judge status: Wrong Answer
N = input()
if len(N)%2:
    print(int('9'+'09'*max((len(N)-3)//2,0))+int(N)-pow(10,(len(N)+1)//2)+1)
else:
    print('9'+'09'*((len(N)-2)//2))
# Judge status: Wrong Answer
import sys
a, b, c = map(int, input().split())
for i in range(b+1):
    if (i*a)%b==c:
        print("Yes")
        sys.exit()
print("No")
# Judge status: Wrong Answer
N = int(input())

ans = []
for i in range(N):
  char = list(input())
  dct = {chr(i):0 for i in range(97, 97+26)}
  for c in char:
    dct[c] += 1
  ans.append(dct)

dd = {chr(i):50 for i in range(97, 97+26)}
for i in range(len(ans)):
  for j in range(97, 97+26):
    dd[chr(j)] = min(ans[i][chr(j)], dd[chr(j)])

res = ''
for k,v in dd.items():
  res += k * v
print(res)
# Judge status: Accepted
h,n = map(int,input().split())
a = list(map(int,input().split()))
if h <= sum(a):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b = map(int, input().split())

ans = "Impossible"
if a%3==0 or b%3==0 or (a+b)%3==0:
  ans = "Possible"
print(ans)
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import accumulate

    N = int(readline())
    A = list(map(int, readline().split()))
    acc = list(accumulate(A))
    S = sum(A)

    ans = INF
    for first in acc:
        second = S - first
        ans = min(ans, abs(first - second))

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())
ans = 0

ans += 2*(x//11)

if 1 <= x%11 < 7:
  ans += 1
elif 7 <= x%11:
  ans += 2
  
print(ans)
# Judge status: Accepted
n=int(input())
blue=[input() for i in range(n)]
m = int(input())
red = [input() for i in range(m)]
money = [0 for i in range(n)]

for i in range(n):
  for j in range(n):
    if blue[i] == blue[j]:
      money[i] += 1
  for k in range(m):
    if blue[i] == red[k]:
      money[i] -= 1

if max(money) >= 0:
  print(max(money))
else:
  print(0)
# Judge status: Accepted
n=int(input())
dp=[i for i in range(n+1)]
for i in range(n):
    for j in range(7):
        if i+6**j>n:
            continue
        dp[i+6**j]=min(dp[i+6**j],dp[i]+1)
        if i+9**j<=n:
            dp[i+9**j]=min(dp[i+9**j],dp[i]+1)
print(dp[n])
# Judge status: Wrong Answer
N, Y = map(int, input().split())

out = '-1 -1 -1'
for x in range(N):
	for y in range(N):
		z = N - x - y if N - x - y >= 0 else 0
		total = 10000 * x + 5000 * y + 1000 * z
		if total == Y:
			out = '{} {} {}'.format(x, y, z)
			break
print(out)
# Judge status: Accepted
a,b=map(int,input().split())
k=b-a
print(sum(range(k))-a)
# Judge status: Accepted
from math import ceil
H=int(input())
W=int(input())
N=int(input())
print(min(ceil(N/H),ceil(N/W)))
# Judge status: Accepted
N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)
S = []
S = list(input())
JS = 0
AS = 0
OT = 0

for i in range(N):
  if S[i] == 'a' and A+B > JS+AS:
    print('Yes')
    JS += 1
  elif S[i] == 'b' and A+B > JS+AS and AS < B:
    print('Yes')
    AS += 1
  else:
    print('No')
# Judge status: Accepted
w,h,x,y = map(int,input().split())
ans = w*h/2
if x == w/2 and y == h/2:
    ans_2 = 1
else:
    ans_2 = 0
print(ans,ans_2)
# Judge status: Accepted
x, y, z = map(int,input().split())

cnt = 1
x -= y + 2*z

while x >= y + z:
    cnt += 1
    x -= y + z
print(cnt)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 0
x = a[0]
for v in a[1:]:
    if v > x:
        ans += v - x
    x = v
print(ans)
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n = int(input())
m = min(4 * q, 2 * h, s)
if d / 2 < m:  # d を優先的に使う
    print((n // 2) * d + (n % 2) * m)
else:
    print(n * m)
# Judge status: Accepted
import sys
s = input()
for bit in range(1 << len(s)-1):
  res = s[0]
  for i in range(len(s)-1):
    if bit & (1<<i):
      res += '+'
    else:
      res += '-'
    res += s[i+1]
  if eval(res) == 7:
    print(res+'=7')
    sys.exit()
# Judge status: Wrong Answer
x="AtCoder"+input()+"Contest"

print("A"+x[8]+"C")
# Judge status: Accepted
i = input()
ans = ""
for s in i:
  if s != "B":
    ans += s
  else:
    ans = ans[:-1]
  
print(ans)
# Judge status: Wrong Answer
import sys

def eat(i,candies,counter):
    s=candies[i]+candies[i-1]
    nc=max(0,s-x)
    counter+=nc
    candies[i]-=nc
    return counter

def main(n,x,candies):
    counter=0
    print(candies)
    if candies[0]>x:
        counter=candies[0]-x
        candies[0]=x
    for i in range(1,n):
        counter=eat(i,candies,counter)
    return counter

n,x=map(int,sys.stdin.readline().strip().split())
candies=list(map(int,sys.stdin.readline().strip().split()))
print(main(n,x,candies))
# Judge status: Accepted
X, N = map(int, input().split())
p = list(map(int, input().split()))

for i in range(X+1):
    for s in [-1, 1]:
        a = X + s * i
        if p.count(a) == 0:
            print(a)
            exit()
# Judge status: Accepted
#!/usr/bin/env python3

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

if (N-1) % (K-1) == 0:
    print((N-1)//(K-1))
else:
    print((N-1)//(K-1)+1)
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
S = list(input())

ans = []
df = 0
f = 0

for i in range(N):
  s = S[i]
  if s == 'c':
    ans.append('No')
    continue
  elif s == 'a':
    df += 1
    if df <= A:
      ans.append('Yes')
    else:
      ans.append('No')
  elif s == 'b':
    df += 1
    f += 1
    if df <= A and f <= B:
      ans.append('Yes')
    else:
      ans.append('No')
      
print('\n'.join(ans))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def combination(n, r, mod=10 ** 9 + 7):
    n1, r = n + 1, min(r, n - r)
    numer = denom = 1
    for i in range(1, r + 1):
        numer = numer * (n1 - i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod - 2, mod) % mod


x, y = map(int, readline().split())
if (x + y) % 3 != 0 or not (x <= 2 * y and y <= 2 * x):
    print(0)
else:
    n = (x + y) // 3
    print(combination(n, y - n))
# Judge status: Wrong Answer
N,C,K = map(int,input().split())

T = []

for i in range(N):
    T.append(int(input()))
T.sort()
res = 0
cnt = 0
i = 0

while i < N:
    lim = T[i]+K
    while T[i] < lim and cnt < C:
        i += 1
        cnt += 1
        if N == i:
            break
    res += 1
    cnt = 0
print(res)
# Judge status: Wrong Answer
def main():
  n, blue, red = input_list()
  d = n % (blue+red)
  if d == 0:
    print(blue * (n // (blue+red)))
  else:
    print(blue * (n // (blue+red))+d)
    
def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

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

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

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

import math
import fractions
from functools import reduce
main()
# Judge status: Accepted
a,b,c,d = map(int,input().split())

if abs(c-a)<=d:
    print("Yes")
elif abs(b-a)<=d and abs(c-b)<=d:
    print("Yes")
else: print("No")
# Judge status: Accepted
a = [0]*5
for i in range(5):
  ai = int(input())
  a[i] = ai
k = int(input())
if a[4]-a[0] > k:
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
import numpy as np

a, b, h, m = map(int,input().split())

beta = 2*np.pi / 60 * float(m)
alpha = 2*np.pi / 12 * h + 2*np.pi /12 /60 * m
theta = abs(alpha - beta)

ans = np.sqrt((a - b*np.cos(theta))**2 + (b*np.sin(theta))**2)

print(ans)
# Judge status: Accepted
x,y,z = map(int,input().split())

x,y = y,x
x,z = z,x
print(x,y,z)
# Judge status: Accepted
import sys

def solve():
    input = sys.stdin.readline
    N, M, K = map(int, input().split())
    possible = False
    for i in range(N + 1):
        for j in range(M + 1):
            black = (N - i) * j + i * (M - j)
            if black == K:
                print("Yes")
                possible = True
                break
        if possible: break
    else: print("No")

    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
suma=sum(a)
dica=Counter(a)
q=int(input())
b=[]
c=[]
for i in range(q):
  b_,c_=map(int,input().split())
  b.append(b_)
  c.append(c_)

i=0
j=0

while i<=(q-1):
  num=dica[b[i]]
  new_sum=suma-b[i]*num+c[i]*num
  print(new_sum)
  
  suma=new_sum
  if c[i] in dica.keys():
    dica[c[i]]+=num
  else:
    dica.setdefault(c[i],num)
  i+=1
# Judge status: Accepted
N, M = map(int, input().split())
ans = [0] * N
ans[0] = 1
w = [1] * N

for i in range(M):
  x, y = map(int, input().split())
  w[x-1] -= 1
  w[y-1] += 1
  if ans[x-1] == 1:
    ans[y-1] = 1
    if w[x-1] == 0:
      ans[x-1] = 0
    
print(sum(ans))
# Judge status: Accepted
import sys
import math
def get_array(): return list(map(int,sys.stdin.readline().strip().split()))
def get_ints(): return map(int,sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
s=input()
print(s[0:3])
# Judge status: Accepted
n, k = map(int, input().split())

okashi = {}
for i in range(k):
    d = int(input())
    a_list = input().split()
    for a in a_list:
        if not a in okashi:
            okashi[a] = True

print(n - len(okashi))
# Judge status: Wrong Answer
n = int(input())
a = [0]+list(map(int,input().split()))
b = []
for i in range(n,0,-1):
    if i>=n/2:
        if a[i]==1:
            b.append(i)
    else:
        if a[i*2]!=a[i]:
            b.append(i)
print(len(b))
print(*b[::-1])
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
A.sort()
A.reverse()
count=0
for i in range(N-1):
    count+=A[i]
print(count)
# Judge status: Accepted
D, T, S = map(int, input().split())
x = D / S
if (x <= T):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A,B = map(int,input().split())

if (A+B)%2==0:
  print((A+B)//2)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
x=int(input())
print(1 if x%100<=x//100*5 else 0)
# Judge status: Accepted
L = int(input())

print('{:.10f}'.format((L/3)**3))
# Judge status: Wrong Answer
import fractions
import math

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

NUM = B-A+1 #対象にしてる整数の個数
CD = int((C*D)/fractions.gcd(C,D))

if A%C == 0:
  DivC = math.ceil(NUM/C)
else:
  NUMC = NUM-(C-A%C)
  DivC = math.ceil(NUMC/C)

if A%D == 0:
  DivD = math.ceil(NUM/D)
else:
  NUMD = NUM-(D-A%D)
  DivD = math.ceil(NUMD/D)

if A%CD == 0:
  DivCD = math.ceil(NUM/CD)
else:
  NUMCD = NUM-(CD-A%CD)
  DivCD = math.ceil(NUMCD/CD)


print(NUM - DivC -DivD + DivCD)
# Judge status: Wrong Answer
n=int(input())
 
a=n//10
if a==3:
 print("bon")
elif a==0 or a==6 or a==8 or a==1:
 print("pon")
else:
 print("hon")
# Judge status: Accepted
n,m = map(int,input().split())
print(n*(n-1)//2 + m*(m-1)//2)
# Judge status: Accepted
N,M = map(int,input().split())

ans = abs((N - 2) * (M - 2))

print(ans)
# Judge status: Accepted
def main():
    s = input().rstrip()
    cnt = [0, 0, 0]
    for c in s:
        if c == "a":
            cnt[0] += 1
        if c == "b":
            cnt[1] += 1
        if c == "c":
            cnt[2] += 1
    cnt.sort()
    if cnt[2] - cnt[0] <= 1:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter
S = list(input())
def zeroandnot0(a, b):
    if (a == 0 and b != 0) or (a != 0 and b == 0):
        return True
    else:
        return False
c = Counter(S)
if zeroandnot0(c['E'], c['W']) or zeroandnot0(c['N'], c['S']):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
k,s=open(0)
k=int(k[2:])
print(s[:k-1]+s[k-1].lower()+s[k:])
# Judge status: Accepted
n = int(input())
nokori = 25-n
eve = ' Eve'*nokori
print('Christmas'+eve)
# Judge status: Accepted
def main():
  f_0 = []
  f_1 = []
  n = int(input())
  for i in range(n):
    x, y = map(int, input().split())
    f_0.append(x-y)
    f_1.append(x+y)
  print(max(max(f_0)-min(f_0),max(f_1)-min(f_1)))
  
if __name__ == "__main__":
  main()
# Judge status: Accepted
from itertools import accumulate


def main():
    section_num = int(input())
    length = list(map(int, input().split()))
    accumulate_length = list(accumulate(length))
    answer = float("inf")
    for i in range(0, section_num):
        answer = min(answer, abs(accumulate_length[-1] - 2 * accumulate_length[i]))
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, K, X, Y = [int(input())for _ in range(4)]
print(min(K,N)*X+max(N-K,0)*Y)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ans = 0
dic = {}
for i in range(1,N):
  x = i-A[i]
  if x<0:
    continue
  else:
    if x in dic:
      dic[x]+=1
    else:
      dic[x]=1
if A[0] in dic:
  ans+=dic[A[0]]
for i in range(1,N):
  x = i+A[i]
  
  if i-A[i] in dic:
    dic[i-A[i]]-=1
    
  if x in dic:
    ans+=dic[x]
  
print(ans)