peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# coding: utf-8
# Your code here!

N=list(input())
if len(set(N))==1:
    print(''.join(N))
else:
    if int(N[0])<int(N[1]) or int(N[0])<int(N[2]):
        N=[int(N[0])+1]*len(N)
    else:
        N=[int(N[0])]*len(N)
    print(''.join(map(str,N)))
# Judge status: Accepted
import os, sys, re, math, queue

W,H,x,y = list(map(int,input().split(' ')))

if x == W/2 and y == H/2:
	print(W*H*1.0/2, 1)
else:
	print(W*H*1.0/2, 0)
# Judge status: Accepted
x = int(input())
count = 0
count = (x // 11)*2
if x % 11 == 0:
    count += 0
elif x % 11 <= 6:
    count += 1
else:
    count += 2
print(count)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
L=sorted(L,reverse=True)
if L[0]<sum(L[1:]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import bisect
N=int(input())
ls=[int(input()) for _ in range(N)]
color=[ls[-1]]
ans=1
for i in range(N-1):
  a=ls[-2-i]
  k=bisect.bisect_left(color,a)
  if k==ans:
    color.append(a)
    ans+=1
  else:
    color[k]=a
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
n=int(input())
s=[int(input()) for i in range(n)]
s.sort()
ans=sum(s)

for i in range(n):
    if ans%10!=0:
        print(ans)
        exit()
    else:
        if s[i]%10!=0:
            ans-=s[i]
        if i==n-1:
            print(0)
# Judge status: Wrong Answer
x,y=map(int, input().split())
if x==2 or y==2:
  print('No')

a=[4,6,9,11]
if (x in a) and (y in a):
  print('Yes')
elif (x not in a) and (y not in a):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def main():
    S = input()
    T = input()

    if S == T[:-1]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
# Judge status: Accepted
s = input()
counter = 0

if len(s) % 2 == 0:
  s_foward = s[:len(s)//2]
  s_back = s[len(s)//2:]
  
  for i in range(len(s_foward)):
    if s_foward[i] != s_back[len(s_back)-i-1]:
      counter += 1
else:
  s_foward = s[:(len(s)-1)//2]
  s_back = s[(len(s)+1)//2:]
  
  for i in range(len(s_foward)):
    if s_foward[i] != s_back[len(s_back)-i-1]:
      counter += 1
    
print(counter)
# Judge status: Accepted
def solve():
    a, b, c, d = map(int, list(input()))
    op = ["+", "-"]
    ans = ""
    for op1 in range(2):
        for op2 in range(2):
            for op3 in range(2):
                s = "a"+op[op1]+"b"+op[op2]+"c"+op[op3]+"d"
                if eval(s) == 7:
                    return str(a)+op[op1]+str(b)+op[op2]+str(c)+op[op3]+str(d)+"=7"


print(solve())
# Judge status: Accepted
a, b, c = map(int,input().split())
a, b = b, a
a, c = c, a
print(a, b, c)
# Judge status: Wrong Answer
from math import floor
a, b, n = [int(x) for x in input().split()]

x = min(b - 1, n)
v1 = floor(a * x / b) - a * floor(x / b)
x = n
v2 = floor(a * x / b) - a * floor(x / b)
print(max(v1, v2))
# Judge status: Accepted
n = int(input())
B = list(map(int, input().split()))
total = B[0]
for i in range(1, n - 1):
    total += min(B[i - 1], B[i])
total += B[n - 2]
print(total)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
#たかはしのa体力、b攻撃
#あおきのc体力、d攻撃
flag = 0
while(c>0 and a>0):
  c -= b
  if (c<=0):
    flag = 1
  a -= d
  if (a<=0 and c>0):
    flag = 2
if (flag == 1):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
P=A[0]
for i in range(2,N):
  P+=A[i//2]
print(P)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

for i in range(1, 1001):
    n = i * a
    if n % b == c:
        print('Yes')
        break
else:
    print('No')
# Judge status: Wrong Answer
X = input()
if X.isupper():
  print("A")
else:
  print("B")
# Judge status: Accepted
S = list(input())
N = int(len(S) / 2)

for i in range(N):
    del S[-2:]
    if S[:int(len(S)/2)] == S[int(len(S)/2):]:
        print(len(S))
        break
    else:
        continue
# Judge status: Accepted
import itertools

def abcd(n):
  for _ in range(n):
    a,b,c,d = map(int,input().split())
    yield a,b,c,d

def main():
  N,M,Q = map(int,input().split())
  num = list(range(1,M+1))
  X = list(abcd(Q))
  for v in itertools.combinations_with_replacement(num, N):
    ans = 0
    for a,b,c,d in X:
      A,B = v[a-1],v[b-1]
      if B-A == c:
        ans += d
    yield ans

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

mx = A[0]
ans = 0
for i in range(1, N):
    if A[i] < mx:
        ans += mx-A[i]
    elif A[i] > mx:
        mx = A[i]
print(ans)
# Judge status: Accepted
n = int(input())

AC = 0
WA = 0
TLE = 0
RE = 0

for _ in range(n):
  judge = input()
  if judge == 'AC':
    AC += 1
  elif judge == 'WA':
    WA += 1
  elif judge == 'TLE':
    TLE += 1
  elif judge == 'RE':
    RE += 1

print('AC x {}'.format(AC))
print('WA x {}'.format(WA))
print('TLE x {}'.format(TLE))
print('RE x {}'.format(RE))
# Judge status: Accepted
a, b = map(int, input().split())

if (a & 1) and (b & 1):
  print("Odd")
else:
  print("Even")
# Judge status: Accepted
n=int(input())
s=input()

#はじめ全員Wであると仮定
E_right,W_left=s.count('E'),0
mi=n #最小値
for i in range(n):
    if s[i]=='E': E_right-=1 #Eならデクリメント
    if W_left+E_right<mi: mi=W_left+E_right #更新
    if s[i]=='W': W_left+=1 #Wならインクリメント
print(mi)
# Judge status: Accepted
N, M, K = map(int, input().split())
answer = set()
for i in range(M+1):
    # iは列で見たときの裏の数
    flipped = N*i
    for j in range(N+1):
        answer.add(flipped + ((M-i)-i)*j)

if K in answer:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, K = map(int, input().split())
S = input()+"."
l = 0
ans = 0

for i in range(N):
    if S[i] != S[i+1]:
        ans += i-l
        l = i+1

print(min(ans+K*2, N-1))
# Judge status: Wrong Answer
N=int(input())
W=list(map(int,input().split()))
for i in range(N-1,0,-1):
  if W[i-1]-1>W[i]:
    print("No")
    exit()
    if W[i-1]+1==W[i]:
      W[i]-=1
print("Yes")
# Judge status: Accepted
print(sum(len(str(-~i))%2>0 for i in range(int(input()))))
# Judge status: Accepted
x = int(input())
if x in [3,5,7]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
v = list(map(int,input().split()))
v.sort()
ans = v[0]
for i in range(1,n):
    ans = (ans+v[i])/2
print(ans)
# Judge status: Accepted
n = int(input())
b = 0
for i in range(1, n+1):
  if i % 2 == 1:
    a = 0
    for j in range(1, i+1):
      if i % j == 0:
        a += 1
    if a == 8:
      b += 1
print(b)
# Judge status: Accepted
from collections import Counter

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

S = sum(A)
cntA = Counter(A)

for _ in range(Q):
    B, C = map(int, input().split())
    D = C - B
    S += D * cntA[B]
    cntA[C] += cntA[B]
    cntA[B] = 0

    print(S)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
print(*(A[::-2]+A[N%2::2]))
# Judge status: Accepted
n=int(input())
li=list(map(int,input().split()))
li[0]-=1
for i in range(1,n-1):
    if li[i]>=li[i+1] and li[i]>li[i-1]:
        li[i]-=1
li2=sorted(li)
if li==li2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,k=map(int,input().split())
print(0--~-n//~-k)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)

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

log = []
check = [False]*N

def func(x, iter):
    x = A[x-1]

    if iter+1 == K:
        return x
    if check[x-1]:
        ix = log.index(x)
        loop = log[ix:]
        tmp = (K-iter-1)%len(loop)
        return loop[tmp]
    else:
        log.append(x)
        check[x-1] = True
        iter += 1
        return func(x, iter)

print(func(1, 0))
# Judge status: Accepted
num = int(input())
a = list(map(int, input().split()))
k = 1
x = y = 0
c = a[0]
for i in a[1:]:
    if c < i:
        x = 1
    elif c > i:
        y = 1
    if x == 1 and y == 1:
        k += 1
        x = y = 0
    c = i
print(k)
# Judge status: Wrong Answer
N = int(input())

c = [[0] * 10] * 10
for x in range(1, N+1):
    check = str(x)
    it = int(check[0])
    jt = int(check[-1])
    c[it][jt] += 1

ans = 0
for i in range(0,10):
    for j in range(0,10):
        ans += c[i][j] * c[j][i]

print(ans)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int,input().split()))

ls = [""] * N
cnt = 0

for i in range(N):
  if P[i] == i + 1:
    ls[i] = "#"
  else:
    ls[i] = "."
    
if ls[-1] == "#":
  if ls[-2] == "#":
    ls[-1], ls[-2] = ".", "."
  else:
    ls[-1] = "."

for j in range(N-1):
  if ls[j] == "#":
    if ls[j+1] == "#":
      ls[j+1] = "."
    cnt += 1
    
print(cnt)
# Judge status: Accepted
s = input() 

print("x" * len(s))
# Judge status: Accepted
n = input()

if n == "ABC":
    print("ARC")
else: 
    print("ABC")
# Judge status: Wrong Answer
import sys
read = sys.stdin.read
from fractions import gcd
from functools import reduce
 
n,*alst = list(map(int, read().split()))

def lcm(x, y):
    g = gcd(x, y)
    g = x * y // g
    return g

g = reduce(lcm, alst)
mod=10**9+7
res=0
for a in alst:
  res+=(pow(a,mod-2,mod)*g)%mod
print(res)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)

a,b,c = map(int,input().split())

if a%2==0 and b%2==0 and c%2==0 and (a == b == c):
	print(-1)
	sys.exit()
cnt = 0
while True:
	if a%2==1 or b%2==1 or c%2==1:
		break
	a,b,c = (b+c)//2,(a+c)//2,(b+c)//2
	cnt += 1

print(cnt)
# Judge status: Accepted
# Problem E - Red Scarf

# input
N = int(input())
a_nums = list(map(int, input().split()))

# initialization
xor_sum = 0
# xor sum
for a in a_nums:
    xor_sum = xor_sum ^ a
ans = []

# xor check
for a in a_nums:
    tmp = xor_sum ^ a
    ans.append(tmp)

# output
print(" ".join(list(map(str, ans))))
# Judge status: Accepted
import itertools

n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
for com in itertools.combinations_with_replacement(range(1, m + 1), n):
    score = sum([d for a, b, c, d in abcd if com[b-1] - com[a-1] == c])
    if ans < score:
        ans = score
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
ans = n % m
if m - ans < ans:
    ans = m - ans
print(ans)
# Judge status: Wrong Answer
n = input()
for i in range(len(n)):
    if n[-i-1] != "9":
        if i == -len(n): print(int(n[0])+9*(len(n)-1))
        else: print(int(n[0])-1+9*(len(n)-1))
        break
else: print(9*len(n))
# Judge status: Accepted
import sys
from itertools import permutations, combinations, combinations_with_replacement
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M, Q = map(int, readline().split())
abcd = [list(map(int, readline().split())) for _ in range(Q)]
l = [i for i in range(1, M + 1)]

ans = 0
for v in combinations_with_replacement(l, N):
    acc = 0
    for a, b, c, d in abcd:
        if v[b - 1] - v[a - 1] == c:
            acc += d
    ans = max(ans, acc)

print(ans)
# Judge status: Accepted
N=input()
N=float(N)
import math
X=math.ceil(N/1.08)
if int(X*1.08)==N:
  print(X)
else:
  print(':(')
# Judge status: Accepted
N = int(input())
# if N % 2 == 0:
#     print(0.5)
# else:
#     print((N + 1)/2 / N)

cnt = 0
for i in range(1, N+1):
    if i % 2 == 1:
        cnt += 1
print(cnt/N)
# Judge status: Accepted
n = int(input())
box = list(map(int, input().split())) 
ans = [0]*n
lst = []
for i in reversed(range(n)):
  count = 0
  for j in range(n//(i+1)):
    count += ans[(i+1)*(j+1)-1]
  if count % 2 == box[i]:
    ans[i] = 0
  else:
    lst.append(i+1)
    ans[i] = 1
    
print(sum(ans))
print(*lst)
# Judge status: Accepted
N, M = list(map(int, input().split()))
L = 0
R = float('inf')

for i in range(M):
    l, r = list(map(int, input().split()))
    L = max(L, l)
    R = min(R, r)

print(max(R-L+1, 0))
# Judge status: Wrong Answer
N,T=map(int,input().split())
CT=[]
for i in range(N):
    ct=list(map(int,input().split()))
    CT.append(ct)
min_cost=10000
for i in range(1,N):
    semi_ans=CT[i]
    if semi_ans[1]<=T:
        ans=CT[i]
        if ans[0]<min_cost:
            min_cost=CT[i][0]
if min_cost==10000:
    print("TLE")
else:
    print(min_cost)
# Judge status: Wrong Answer
order = [int(input()) for _ in range(5)]
tmp=0
diff = 9
for i in order:
  if i%10 != 0:
    diff = min(i%10, diff)
    tmp+=((i//10)+1)*10
  else:
    tmp+=i
print(tmp-10+diff)
# Judge status: Accepted

[X,Y,Z] = list(map(int,input().split()))

i=0
while True:
    need= i*Y + (i+1)*Z
    if need>X:
        break
    i+=1

print(i-1)
# Judge status: Accepted
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))
# Judge status: Wrong Answer
num=int(input())
cnt=0
while num % 2==0:
  num//=2
  cnt+=1
  print(cnt)
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())
if (A//K + 1 )*K <= B or A%K == 0: 
    print("OK")
else:
    print("NG")
# Judge status: Wrong Answer
N,M,K = map(int, input().split())
A = map(int, input().split())
B = map(int, input().split())

sa = {-1: 0}
for i, val in enumerate(A):
  sa[i] = sa[i-1] + val

sb = {-1: 0}
for i, val in enumerate(B):
  sb[i] = sb[i-1] + val

max_num = 0

for i in range(N):
  for j in range(M):
    if(sa[i]+sb[j]<=K):
      max_num = max(max_num,i+j+2)
      
      
print(max_num)
# Judge status: Accepted
n = int(input())
c = list(input())
ans = 0
for i in range(c.count("R")):
    if c[i] == "W":
        ans += 1
print(ans)
# Judge status: Accepted
k,x = map(int,input().split())
if 500*k >= x:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
def q(l):
	a=''
	for i in range(len(l)):
		a = a+l[i]
		a = a[::-1]
		
	return a

	
			
n=int(input())
a=list(input().split())

ans = q(a)

print(' '.join(ans))
# Judge status: Accepted
N, W = map(int, input().split())
value, weight = [0], [0]
for _ in range(N):
  w, v = map(int, input().split())
  weight.append(w)
  value.append(v)
dp = [[-1]*(W+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1, N+1):
  for j in range(W+1):
    dp[i][j] = max(dp[i][j], dp[i-1][j])
    if -1 < j-weight[i]:
      dp[i][j] = max(dp[i][j], dp[i-1][j-weight[i]]+ value[i])
print(max(dp[N]))
# Judge status: Accepted
N = int(input())

cnt = 0
for a in range(1, N + 1):
    b = 1
    while True:
        if a * b < N:
            cnt += 1
        else:
            break
        b += 1
print(cnt)
# Judge status: Accepted
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
from collections import deque
n=int(input())
prev=0
l=[]
for i in range(n):
	l.append(list(map(int,input().split())))
z=[[0,0,0] for i in range(n)]
z[0]=l[0]
for i in range(1,n):
	z[i][0]=l[i][0]+max(z[i-1][1],z[i-1][2])
	z[i][2]=l[i][2]+max(z[i-1][1],z[i-1][0])
	z[i][1]=l[i][1]+max(z[i-1][0],z[i-1][2])
print(max(z[-1]))
# Judge status: Accepted
def greenandredapples():
    X, Y, A, B, C = list(map(int, input().split()))
    RedD = sorted(list(map(int, input().split())))
    GreenD = sorted(list(map(int, input().split())))
    Colorl = sorted(list(map(int, input().split())))

    considered = RedD[-X:] + GreenD[-Y:]
    Colorl.extend(considered)
    return sum(sorted(Colorl,reverse=True)[:X+Y])

print(greenandredapples())
# Judge status: Accepted
N = int(input())
txy = [tuple(map(int,input().split())) for _ in range(N)]
t = 0
x = 0
y = 0
for i in range(N):
    nt,nx,ny = txy[i]
    t = nt-t
    x = nx-x
    y = ny-y
    d = abs(x)+abs(y)
    if t < d:
        print("No")
        exit(0)
    elif (t-d)%2 == 1:
        print("No")
        exit(0)
    t,x,y = txy[i]
print("Yes")
# Judge status: Accepted
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
ans=""
ans+="R"*dx+"U"*dy
ans+="R"+"D"*(dy+1)+"L"*(dx+1)+"U"
ans+="U"*dy+"R"*dx
ans+="U"+"L"*(dx+1)+"D"*(dy+1)+"R"
print(ans)
# Judge status: Wrong Answer
n=int(input())
w=list(map(int,input().split()))

a=[]

for i in range(1,n):
    ans=(w[:i])
    if 2*sum(ans)-sum(w)>=0:
        a.append(2*sum(ans)-sum(w))
        
print(min(a))
# Judge status: Accepted
a, b = map(int,input().split())
if a*b % 2 != 0:
	print('Odd')
else:
	print('Even')
# Judge status: Wrong Answer
N = int(input())
C = {}
for _ in range(N):
    a = input().strip()
    if a not in C:
        C[a] = 0
    C[a] += 1
M = int(input())
for _ in range(M):
    a = input().strip()
    if a not in C:
        C[a] = 0
    C[a] -= 1
cmax = -100
for a in C:
    cmax = max(cmax,C[a])
print(cmax)
# Judge status: Accepted
N, x = map(int,input().split())
a = sorted([int(i) for i in input().split()])
count = 0
if sum(a) == x:
    print(len(a))
else:
    for i in a:
        x = x-i
        if x<0:
            break
        count+=1
    if count == N:
        print(N-1)
    else:
        print(count)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

cnt = 0
ans = 0

for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0

if cnt > ans:
    ans = cnt

print(ans)
# Judge status: Accepted
n=int(input())
a=[int(input()) for i in range(n)]
c=sorted(a)
b=max(a)
for i in range(n):
  if a[i]==b:
    print(c[n-2])
  else:
    print(b)
# Judge status: Accepted
# 整数A,B,Cを入力
A,B,C = map(int,input().split())
# 整数CがA以上かつB以下であればYes,そうでなければNo
if A <= C and C <= B:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, R = map(int, input().split())

if N >= 10 :
  print(R)
else :
  print(R + 100 * (10 - N))
# Judge status: Wrong Answer
n,k = map(int, raw_input().split())
s = raw_input()
cd = 0
d = None
for l in s:
	if d != l:
		cd +=1
		d = l
score = 0
for u,v in zip(s,s[1:]):
	if u == v:
		score +=1



if cd > 2:
	t = min(k,(cd - 2))
	k -= t
	score += 2 * t 
	cd -= 2 * t
if cd == 2 and k:
	score +=1
	cd -= 1
print score
# Judge status: Wrong Answer
N=int(input())
i=int (0)
S=[]
for i in range(N):
    if i%3!=0 and i%5!=0:
        S.append(i)
    
print(sum(S))
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a<=0 and b >= 0:
    print("Zero")
elif a>0 and b > 0:
    print("Positive")
else:
    if b-a+1%2 != 0:
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
def main(s: str, k: int):
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return

    print(1)


if __name__ == "__main__":
    s = input()
    k = int(input())

    main(s, k)
# Judge status: Accepted
# D
def main():
  #N = 4000
  #S = ["RGB"[random.randint(0, 2)] for _ in range(N)]

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

  import collections

  c = collections.Counter(S)

  total = c["B"]*c["G"]*c["R"]

  for d in range(1, N//2+1):
    for i in range(N-d-d):
      if len({S[i], S[i+d], S[i+d+d]})==3:
        total -= 1
  
  print(total)

main()
# Judge status: Accepted
S=list(input())
even=[]
odd=[]
for i in range(len(S)):
    if i%2==0:
        even.append(S[i])
    else:
        odd.append(S[i])
if not "L" in even and not "R" in odd:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
numbers = set(map(int, input().split()))
if len(numbers) == 2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())
def k(a,b):
    ans=0
    while (a!=0):
        ans+=a%b
        a//=b
    return ans
res=10**10
for i in range(n+1):
    res=min(res,k(i,9)+k(n-i,6))
print(res)
# Judge status: Accepted
A,B,C,K = input().split()
a = int(A)
b = int(B)
c = int(C)
k = int(K)

B_number = 0
C_number = 0

A_number = min(a,k)
k1 = k - a
if k1 > 0:
    B_number = min(b,k1)
    k2 = k1 - b
    if k2 > 0:
        C_number = min(c,k2)

print(A_number-C_number)
# Judge status: Wrong Answer
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

ans = S.count("I") - S.count("D")
print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    xy = [list(map(int, input().split())) for _ in [0]*n]
    z1 = [x+y for x, y in xy]
    z2 = [x-y for x, y in xy]
    z3 = [-x+y for x, y in xy]
    z4 = [-x-y for x, y in xy]
    print(max([max(z1)-min(z1), max(z2)-min(z2),
               max(z3)-min(z3), max(z4)-min(z4)]))


main()
# Judge status: Accepted
from collections import Counter

def factorize(N):
    p = 2
    PRIME = []
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.append(p)
        else:
            p += 1
    if N > 1:
        PRIME.append(N)
    return Counter(PRIME)

n = int(input())

prime = factorize(n)
ans = 0
for i in prime:
    for j in range(1,prime[i]+1):
        if n % i ** j == 0:
            n //= i ** j
            ans += 1
print(ans)
# Judge status: Wrong Answer
n , x = map(int , input().strip().split())
a  = list(map(int , input().strip().split()))
a.sort()
count = 0

for i in a:
  if x - i < 0:
    break
  x -= i
  count += 1

print(count)
# Judge status: Wrong Answer
from sys import exit
X, Y = map(int,input().split())
if X % Y == 0 or Y % X == 0: print(-1)
else:
  for i in range(X,10 ** 18 + 1,X):
    if i % Y != 0:
      print(i)
      exit()
# Judge status: Wrong Answer
from operator import mul
from functools import reduce
import math

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

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

ans = 0
for i in range(0,a[0]):
    if(i != a[1] and i != a[2]):
            ans += cmb(a[0],i)
            #print("ans:%d"%(ans))
        
print(ans%(10**9+7))
# Judge status: Accepted
s=list(input())
ans=[]
for i in s:
    if i=="0":
        ans.append("0")
    if i=="1":
        ans.append("1")
    if i=="B" and len(ans)>0:
        ans.pop(-1)
print("".join(ans))
# Judge status: Accepted
a, b, c = map(int, input().split())
print(("Yes" if a <= c <= b else "No"))
# Judge status: Accepted
n=input()
print('ARC' if n=='ABC' else 'ABC')
# Judge status: Wrong Answer
K, N = map(int, input().split())
A = sorted(map(int, input().split()))

length = K//2
for i in range(N-1):
    length = max(A[i+1] - A[i] , length)
    if length == A[i+1] - A[i]:
        ans = A[i] + K - A[i+1]
      
if length <= K//2:
    ans = A[-1] - A[0]
print(ans)
# Judge status: Accepted
K, S = map(int,input().split())
ans = 0
for X in range(K+1):
    for Y in range(K+1):
        if 0 <= S-(X+Y) <= K:
            ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

x = 0
y = 0
z = 0
for i in a:
  if i%4 == 0: x += 1
  elif i%2 == 0: y += 1
  else: z += 1

if y%2+z-1 <= x: print("Yes")
else: print("No")
# Judge status: Accepted
x, y = list(map(int, input().split()))


if y % 2 != 0:
    print("No")
else:
    if 2*x <= y <= 4*x:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n = int(input())
print('ABC' if n < 1000 else 'ABD')
# Judge status: Accepted
N = int(input())
number = N
List = [0 for i in range(1000000)]
answer = 0

def cul(x):
    number = 1
    while x >= (number+2)*(number + 1)//2:
        number += 1
    return number

i = 2
while number > 1:
    while number % i == 0:
        number //= i
        List[i] += 1
    i +=1

    if i == 1000001:
        answer = 1
        break

for x in List:
    if x == 0:
        continue
    else:
        answer += cul(x)

print(answer)
# Judge status: Accepted
n,k,q = map(int, input().split())

l = [k-q]*n
for _ in range(q):
  l[int(input())-1] += 1

for i in l:
  print("Yes" if i > 0 else "No")
# Judge status: Accepted
n,m = map(int, input().split())
h_list = list(map(int,input().split()))
ans = [1]*n
for i in range(m):
    a,b = map(int, input().split())
    if h_list[a-1] == h_list[b-1]:
        ans[a-1] = 0
        ans[b-1] = 0
    else:
        if h_list[a-1] > h_list[b-1]:
            ans[b-1] = 0
        else:
            ans[a-1] = 0
print(sum(ans))
# Judge status: Accepted
x = list(map(int, input().split()))
x.sort()
f = True
for i, e in enumerate(x):
    tmp = 5
    if i == 2:
        tmp = 7

    f &= (tmp == e)
print("YES" if f else "NO")