peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n,c,k = map(int,input().split())
t = []
for i in range(n):
    t.append(int(input()))
    
t = sorted(t)
ans = 1
passenger = 0
first = 0
for i in range(n):
    if first == 0:
        first = t[i]
    if passenger < c and t[i] < first + k:
        passenger +=1
        if i == n-1:
            ans +=1
    else:
        passenger = 0
        first = 0
        ans +=1
print(ans)
# Judge status: Wrong Answer
S=input()
a=set()
for s in S:
  a.add(s)
a=list(a)
if len(a)==4:
  print('Yes')
elif len(a)==2:
  if (a[0]=='N' or a[0]=='S') and (a[1]=='N' or a[1]=='S'):
    print('Yes')
  elif (a[0]=='E' or a[0]=='W') and (a[1]=='E' or a[1]=='W'):
    print('Yes')
else:
  print('No')
# Judge status: Accepted
S = input()
LS = list(S)

if len(set(LS)) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import heapq
import collections
N = int(input())
A = list(map(int, input().split()))

table = collections.defaultdict(int)
hq = [0, 0]
for x in A:
    table[x] += 1
    if table[x] == 2:
        heapq.heappush(hq, -x)
        table[x] = 0
print(heapq.heappop(hq) * heapq.heappop(hq))
# Judge status: Accepted
s = list(map(int, input().split()))
s.sort()

print(s[0] + s[1])
# Judge status: Accepted
num = input()

num1,num2 = num.split(' ')

num1 = int(num1)
num2 = int(num2)

if num1 > 9 or num2 > 9:
    print('-1')
else:
    print (num1 * num2)
# Judge status: Accepted
D, N = map(int, input().split())
if N == 100:
    ans = 100 ** D * (N+1)
else:
    ans = 100 ** D * N
print(ans)
# Judge status: Wrong Answer
import sys
n = sys.stdin.readline().rstrip()[-1]
d = {
  '0': 'pon',
  '1': 'pon',
  '2': 'hon',
  '3': 'bon',
  '4': 'hon',
  '5': 'hon',
  '6': 'pon',
  '7': 'hon',
  '8': 'pon',
  '9': 'hon',
}
print(n, d[n])
# Judge status: Wrong Answer
w,h, x,y = map(int,input().split())
a = 0
b = 0
a = (w)*(h-y)
b = (w)*y
ans = 0
ans = min(a,b)

ans2 = 0
a = h*(w-x)
b = h*(x)
ans2 = min(a,b)

if ans<ans2:
    print(ans2, 0)
elif ans2<ans:
    print(ans, 0)
else:
    print(ans, 1)
# Judge status: Accepted
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, X = I()
L = [0] + l()
l = list(itertools.accumulate(L))

for i in l:
    if i <= X:
        count += 1

print(count)
# Judge status: Accepted
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n)]
for i in d:
  l[i] += 1
cou = 1
if 0 in l:
  a = l.index(0)
  if sum(l[a:])!=0:
    print(0)
    exit()
for i in range(n-2):
  if l[i+1]!=0:
    a = l[i]
    b = l[i+1]
    cou *= (a**b)%mod
print(cou%mod)
# Judge status: Accepted
S = int(input())

L =[]
for _ in range(10**6):
  L.append(0)

for i in range(10**6):
  L[S-1] += 1
  #print(L)
  if L[S-1] > 1:
    print(i+1)
    break
  
  if S%2 == 0:
    S = S//2
  else :
    S = S*3 + 1
# Judge status: Wrong Answer
S = input()
word = ""
i = 0
while i < len(S):
    if S[i] in word:
        print("Yes")
        exit()
    word = word + S[i]
    i += 1
print("No")
# Judge status: Wrong Answer
a, b, c=(int(x) for x in input().split())
print('bust'if a+b+c >=21 else'win')
# Judge status: Wrong Answer
n, m = map(int, input().split())

if n * 2 >= m:
    print(n // 2)
else:
    print(n + (m - 2 * n) // 4)
# Judge status: Accepted
#!/usr/bin/env python3

a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            value = 500*i+100*j+50*k
            if value == x:
                ans += 1

print(ans)
# Judge status: Wrong Answer
N,K=map(int,input().split())
ans=0
temp=1
while temp<N:
    temp*=K
    ans+=1
print(ans)
# Judge status: Accepted
from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))
a.sort()
d = defaultdict(int)
for ai in a:
    d[ai] += 1

m = a[-1]
x = [True for _ in range(m + 1)]

ans = 0
c = defaultdict(bool)
for ai in a:
    if x[ai] and d[ai] == 1:
        ans += 1
    if not c[ai]:
        c[ai] = True
        for j in range(2 * ai, m + 1, ai):
            x[j] = False
print(ans)
# Judge status: Accepted
print(["NO","YES"][int(input()[2::2])%4==0])
# Judge status: Wrong Answer
N = int(input())
A = [int(x) for x in input().split()]
if len(A) != len(set(A)):
    print("NO")
else:
    if A.count(N) > 0:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
n, k = map(int, input().split())
a = n%k
b = abs(a - k)
print(min(a, b))
# Judge status: Accepted
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

result = 0

for i in range(n):
    cnt = sum(a1[:i+1]) + sum(a2[i:])
    result = max(result, cnt)
    
print(result)
# Judge status: Accepted
S=input()

if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
	print("Bad")
else:
	print("Good")
# Judge status: Wrong Answer
inp = [input() for i in range(2)]
K = int(inp[0])
A,B = inp[1].split()
A,B = int(A),int(B)
c,bbb = 0,0
if 1<= A <= B <= 1000 and 1<= K <= 1000:
  for h in range(A,B,1):
    c = h % K
    if c == 0:
      bbb += 1
  if bbb > 0:
    print('OK')
  else:
    print('NG')
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

# 等差数列の和
h_b = sum(range(1, b - a + 1))

print(h_b - b)
# Judge status: Accepted
mod = 10**9 + 7

n,k = map(int,input().split())
tot = []
cur = 0
for i in range(n+1):
    cur += i
    tot.append(cur)

cnt = 0
for i in range(k, n+2):
    if n > i:
        max_ = tot[n] - tot[n - i]
    else:
        max_ = tot[n]
    min_ = tot[i - 1]
    cnt += max_ - min_ + 1
    cnt %= mod
print(cnt)
# Judge status: Accepted
S=str(input())
T=str(input())
min_count=len(T)
for i in range((len(S)-len(T))+1):
    count=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            count+=1
    min_count=min(count,min_count)
print(min_count)
# Judge status: Wrong Answer
[h1,m1,h2,m2,k] = [int(i) for i in input().split()]

print((h2 - h1) * 60 + (m1 - m2) - k)
# Judge status: Accepted
n,k = map(int,input().split())

person = set(range(1,n+1))
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        if a[j] in person:
            person.discard(a[j])

print(len(person))
# Judge status: Wrong Answer
(n,h),*ab = [list(map(int, s.split())) for s in open(0)]

mxa = max([a for a, b in ab])
bb = sorted([b for a, b in ab if b>mxa],reverse=True)

ans = 0
for b in bb:
    h-=b
    ans += 1
    if h<=0:
        break
if h>0:
    ans += (1--h//mxa)
print(ans)
# Judge status: Accepted
from itertools import permutations
import math
menu=5
times=[int(input()) for i in range(menu)]
orders=list(permutations(times))
minimum=sum(math.ceil(time/10)*10 for time in times)
for order in orders:
    total=order[0]
    for i in range(1,menu):
        total+=math.ceil(order[i]/10)*10
    minimum=min(minimum,total)
print(minimum)
# Judge status: Accepted
# B - YYMM or MMYY

s = str(input()) # 長さ４の数字列

def check(n):
    if n > 0 and n <= 12:
        return True
    else:
        return False

mae = check(int(s[0:2]))
ato = check(int(s[2:4]))

if mae and ato:
    print('AMBIGUOUS')
elif mae and not ato:
    print('MMYY')
elif not mae and ato:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
n,a,b = map(int, input().split())

if n % (a+b) <= a:
  print(n//(a+b)*a + n % (a+b))
else:
  print(n//(a+b)*a + a)
# Judge status: Accepted
n=int(input())
D=0
d=10**10
f=10**10
F=-10**10
for i in range(n):
    x,y=[int(x) for x in input().split()]
    l=x+y
    d=min(d,l)
    D=max(D,l)
    if y-x<f:
        m=[x,y]
        f=y-x
    if y-x>F:
        M=[x,y]
        F=y-x
e=abs(m[0]-M[0])+abs(m[1]-M[1])
ans=max(D-d,e)
print(ans)
# Judge status: Wrong Answer
n,k = map(int, input().split())

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

res =0
for i in range(n):
    if al[i] > k:
        res +=1
        
print(res)
# Judge status: Wrong Answer
S=input()
if S[0]=="A":
  c=0
  d=0
  for x in range(2,len(S)-1):
    if S[x].islower():
      d+=1
    if S[x]=="C":
      c+=1
  if c==1 and d==len(S)-4 and S[1].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
# Judge status: Accepted
from collections import Counter

N=int(input())
A=[int(i) for i in input().split()]
A=Counter(A)
e1=0
e2=0
for key,value in A.items():
    if value<2:
        continue
    elif value>=4:
        e1=max(e1,key)
        e2=max(e2,key)
    else:
        if key>e1:
            e2=e1
            e1=key
        else:
            e2=max(e2,key)
print(e1*e2)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
b = [x[1] - x[0] for x in enumerate(A,1)]
mean1 = sum(b) // N
mean2 = mean1 - 1
mean3 = mean1 + 1
c1 = [abs(x-mean1) for x in b]
c2 = [abs(x-mean2) for x in b]
c3 = [abs(x-mean3) for x in b]
print(min(sum(c1),sum(c2),sum(c3)))
# Judge status: Accepted
mydict = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
S = input()
print(mydict[S])
# Judge status: Accepted
from functools import lru_cache
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
left = -10**9
right = 10**9

@lru_cache(maxsize=100000)
def cal(num):
  tmp = 0
  for i in range(n):
    tmp += abs(a[i]-(num+(i+1)))
  return tmp
 

while abs(right-left)>1:
  mid = (right+left)//2
  if cal(mid-1)<cal(mid+1):
    right = mid
  else:
    left = mid
print(min(cal(left),cal(right)))
# Judge status: Wrong Answer
a, b = map(int, input().split())
gcd = 1
for i in range(1, a+1):
    if a % i == b % i == 0:
        gcd *= i
print(int(a * b / gcd))
# Judge status: Accepted
import sys
input = sys.stdin.readline

N, D = map(int, input().split())
ans = 0

for _ in range(N):
    X, Y = map(int, input().split())
    
    if X**2+Y**2<=D**2:
        ans += 1

print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
flag = any([
    a + b == c,
    b + c == a,
    c + a == b
])
print('Yes' if flag else 'No')
# Judge status: Accepted
x = int(input())
if x%11 > 6:
    ans = x//11 *2 +2
elif x %11==0:
    ans = x//11 *2
else:
    ans = x//11 *2 +1
print(ans)
# Judge status: Accepted
import random

D = int(input())
c_list = list(map(int, input().split()))
s_list = [list(map(int, input().split())) for _ in range(D)]

for i in range(D):
    print(random.randint(1,26))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

T={}
for a in A:
    if a in T:
        T[a]+=1
    else:
        T[a]=1

K=0
for b in T:
    if T[b]<b:
        K+=T[b]
    elif b<T[b]:
        K+=T[b]-b
print(K)
# Judge status: Accepted
icase=0
if icase==0:
    w,a,b=map(int,input().split())
    if a+w<b:
        print(b-(a+w))
    elif b<=a+w and  a<=b+w:
        print(0)
    else:
        print(a-(b+w))
# Judge status: Wrong Answer
"""
- N players, K points each player has, Q correct answers
- Substruct Q from K and add score to each players
"""

N,K,Q = map(int,input().split())
A = (int(x) for x in input().split())

score = [K-Q] * (N+1) 
for x in A:
    score[x] += 1

ans = '\n'.join('No' if x <= 0 else 'Yes' for x in score[1:])
print(ans)
# Judge status: Accepted
a = int(input())
ar = list(map(int,input().split(" ")))
k = 0
g = 0
f = 0
for r in ar:
    if r % 4 == 0:
        f += 1
    elif r % 2 == 0:
        g += 1
    else:
        k += 1
if k - f > 1:
    print("No")
elif k - f == 1:
    if g == 0:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N):
    if P[i] == i + 1:
        ans += 1
print(max(ans - 1, 0))
# Judge status: Accepted
A,B,C,D = map(int,(input().split()))
i=0
while(A>0 and C>0):
  if(i%2==0):
    C-=B
  else:
    A-=D
  i+=1
if(A>0):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())

a_ = b
b_ = a

a__ = c
c_ = a_

print(a__, b_, c_)
# Judge status: Accepted
N=int(input())
X = list(map(int,input().split()))
Y=set(X)
Z=list(Y)
NN=len(Z)
AA=0
for i in range(NN-2):
  for ii in range(NN-2-i):
    for iii in range(NN-2-i-ii):
      A=[Z[i], Z[ii+i+1], Z[iii+ii+i+2]]
      if max(A)<Z[i]+Z[ii+i+1]+Z[iii+ii+i+2]-max(A):
        AA+=X.count(Z[i])*X.count(Z[ii+i+1])*X.count(Z[iii+ii+i+2])
if N<3:
  print(0)
else:
  print(AA)
# Judge status: Accepted
n, k = list(map(int, input().split()))

h = [int(input()) for _ in range(n)]

h.sort()

s = h[-1] - h[1]

for i in range(n-k+1):
    s = min(s, h[i+k-1]-h[i])

print(s)
# Judge status: Wrong Answer
import sys
import numpy as np
import itertools

p,q,r = input().split()
p = int(p)
q = int(q)
r = int(r)
dest_min = p + q + r
dest = np.array(list(itertools.combinations([p,q,r],2)))
print(dest)

for dest_sample in dest:
    dest_min = min(dest_min, np.sum(dest_sample))

print(dest_min)
# Judge status: Accepted
Q,H,S,D=map(int,input().split())
N=int(input())

one=min (4*Q,2*H,S)
if N==1:
    print(one)
else :
    if 2*one<=D:
        print(N*one)
    else:
        if N%2==0:
            print((N//2)*D)
        else:
            print((N//2)*D+one)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))

b = [0 for i in range(N//2)]+a[N//2:]

for i in range(N//2-1,-1,-1):
    if sum(b[i::i+1])%2 == 0:
        b[i] = a[i]
    else:
        b[i] = 1-a[i]

ans = []
for i in range(N):
    if b[i] == 1:
        ans.append(i)

print(len(ans))
print(' '.join(map(str,ans)))
# Judge status: Wrong Answer
import math

h, w = list(map(int,input().split()))

ans = math.ceil((h*w)/2)

print(int(ans))
# Judge status: Accepted
h,w = map(int, input().split())

if h==1 or w==1:
    print(1)
elif h%2 and w%2:
    print((h*w+1)//2)
else:
    print(h*w//2)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  if a[i]<0:
    cnt+=1
if min(a)>=0:
  print(sum(a))
  exit()
b=[abs(a[i]) for i in range(n)]
s=sum(b)
if cnt%2==0:
  print(s)
  exit()
ans=-10**18
for i in range(n):
  ans=max(ans,s-2*b[i])
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = str(input())

cnt=0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if s[i]!=s[j]!=s[k]and j-i!=k-j:
                cnt+=1

print(cnt)
# Judge status: Accepted
s = input()
if 'a'<= s <= 'z':
  print('a')
else:
  print('A')
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,k = map(int,readline().split())
lst1 = list(map(int,readline().split()))

for i in range(n-k):
    if lst1[i] >= lst1[i+k]:
        print("No")
    else:
        print("Yes")
# Judge status: Wrong Answer
import heapq
import bisect

def main():
    N = int(input())
    l = []

    for i in range(N):
        a = int(input())
        if len(l) == 0 or a <= l[0]:
            heapq.heappush(l, a)
        else:
            ind = bisect.bisect_right(l, a)
            l[ind-1] = a
    print(len(l))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
x = int(input())
x,y=divmod(x, 11)
if y > 6:
    print(x+2)
elif y > 0:
    print(x+1)
else:
    print(x)
# Judge status: Accepted
A=int(input())
b0=2
b1=1
save=0
for i in range(A-1):
    save=b1
    b1=b0+b1
    b0=save
print(b1)
# Judge status: Accepted
A, B, C = map(int, input().split())

if (A == B and B == C) or (A != B and B != C and C != A):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
a=list(map(int,input().split()))
al=sum(a)
if al <=21:
    print("win")
else:
    print("bust")
# Judge status: Wrong Answer

def main():
  num = input()
  return num*num
# Judge status: Accepted
d, n = map(int, input().split())

if n == 100:
    print(100 ** d * (n+1))
    exit()
print(100 ** d * n)
# Judge status: Accepted
n, m = map(int, open(0).read().split())

if n >= m//2:
    print(m//2)
else:
    print(n + (m-2*n)//4)
# Judge status: Accepted
s = input()
ans = 0
for r in s:
    if r == 'R':
        ans += 1
if ans == 2 and s == 'RSR':
    print(1)
else:
    print(ans)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))

for i in range(1,n):
    if h[i-1]-h[i]>0:
        print('No')
        exit()
    elif h[i-1]-h[i] == -1:
        h[i] -= 1
print('Yes')
# Judge status: Accepted
n=int(input())
ans=0
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
for i in reversed(range(n)):
  if a[i][1] != 1 and a[i][0] != 0:
    a[i][0] += ans
    if a[i][0] % a[i][1] != 0:
      ans += a[i][1] - a[i][0] % a[i][1]
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
S=input()
for i in range(len(S)):
  if i==a:
    if S[i]!="-":
      print("No")
      break
  else:
    try:
      Si = int(S[i])
    except:
      print("No")
      break
else:
  print("Yes")
# Judge status: Wrong Answer
a = int(input())
ans = a*800 - (a%15)*200
print(ans)
# Judge status: Accepted
k=int(input())
a,b=map(int,input().split())
n=1
while k*n<=b:
  n+=1
print('OK' if a<=(n-1)*k<=b else 'NG')
# Judge status: Accepted
from math import sqrt
a,b,c=map(int,input().split())
if (c-a-b)>0 and 4*a*b<(c-a-b)*(c-a-b):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, W = map(int, input().split())
wv = [tuple(map(int, input().split()))for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(N):
    for j in range(W):
        w, v = wv[i]
        if N < i+1:
            continue
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if W < j+w:
            continue
        dp[i+1][j+w] = max(dp[i][j+w], dp[i][j]+v)
print(dp[-1][-1])
# Judge status: Accepted
a,b,c,d = map(int,input().split())

import math

if math.ceil(c/b)<=math.ceil(a/d):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

dp = [10**6 for _ in range(10**6)]
dp[0] = 0

for i in range(n):
    j6 = 1
    while j6 <= n:
        dp[i+j6] = min(dp[i+j6],dp[i]+1)
        j6 *= 6
    j9 = 1
    while j9 <= n:
        dp[i+j9] = min(dp[i+j9],dp[i]+1)
        j9 *= 9
print(dp[n])
# Judge status: Accepted
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = []
b = []
for i in range(m):
    x = list(map(int, input().split()))
    a.append(x[0])
    b.append(x[1])

ans = [True for i in range(n)]

for x, y in zip(a, b):
    if h[x-1] < h[y-1]:
        ans[x-1] = False
    elif h[x-1] > h[y-1]:
        ans[y-1] = False
    elif h[x-1] == h[y-1]:
        ans[x-1] = False
        ans[y-1] = False

print(ans.count(True))
# Judge status: Wrong Answer
N, M = map(int, input().split())

hints = []
for _ in range(M):
  a, b = map(int, input().split())
  hints.append((a, b))
  
def solve(n, hints):
  for i in range(10 ** (N + 1)):
    s = str(i)
    if all(len(s) == N and s[hint[0] - 1] == str(hint[1]) for hint in hints):
      return i
  return -1
      
print(solve(N, hints))
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()
print('No' if ('##' in s[a-1:c]) or ('##' in s[b-1:d]) or (c > d and '...' not in s[b-2:d+1]) else 'Yes')
# Judge status: Accepted
n=int(input())
s=list(input())
w=s.count('.')
if s[0]=='.':
    sm=1
else:
    sm=0

def change(y):
    total=(y+1-sm)+(w-sm)
    return total
mn=change(0)
for i in range(1,n):
    if s[i]=='.':
        sm += 1
    mn=min(mn,change(i))
mn=min(mn,w)
print(mn)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
dp = [0,abs(h[0]-h[1])]

for i in range(2,n):
  dp.append(min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1])))

print(dp[-1])
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = list(map(int,input().split()))

now = 1

from fractions import gcd

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

for i in a:
    now = lcm(now,i//2)

print(m//now-(m//now)//2)
# Judge status: Accepted
N = int(input())

ans = (10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7)

print(int(ans))
# Judge status: Accepted
from math import sqrt

N, D = [int(i) for i in input().split()]

XS = [list(int(i) for i in input().split()) for _ in range(N)]

cnt = 0
for i in range(N):
  for j in range(i+1, N):
    if sqrt(sum((y - z) ** 2 for y, z in zip(XS[i], XS[j]))).is_integer():
      cnt += 1
      
print(cnt)
# Judge status: Accepted
S = input()
T = input()

if len(S) + 1 == len(T) and T.startswith(S):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
O=input()
E=input()
p=""
if len(O)==len(E):
    for i in range(len(O)):
        p+=O[i]
        p+=E[i]
elif len(O)>len(E):
    for i in range(len(O)-1):
        p+=O[i]
        p+=E[i]
    p+=O[-1]
print(p)
# Judge status: Accepted
A,B,C=map(int,input().split())
count=0
if A==B==C and A%2==0:
    print(-1)
    exit()
while A%2==0 and B%2==0 and C%2==0:
    A,B,C=B//2+C//2,A//2+C//2,B//2+C//2
    count+=1
print(count)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
count = 1
l = 0
for i in a:
  count *= i
  if count > 1000000000000000000:
    l = -1
    break
if l == 0:
  print(count)
else:
  print(-1)
# Judge status: Accepted
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, K = iim()

    ans = N % K
    print(min(ans, K - ans))

if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
import statistics
n = int(input())
X = list(map(int, input().split()))
med = sorted(X)[n//2-1]
X_ = sorted(X)
X_.remove(med)
for i in range(n-1):
    if X_[i]>=med:
        med_2 = X_[i]
        break
for i in range(n):
    if X[i]>med:
        print(med)
    elif X[i]==med:
        print(med_2)
    else:
        print(med_2)
# Judge status: Wrong Answer
k = int(input())
n = 0
a,b = map(int,input().split())
while True:
    n += k
    if n >= a and n >= b:
        print("OK")
        break
    if n > b:
        print("NG")
        break
# Judge status: Accepted
N, D = map(int, input().split())
print(-(-N // (D * 2 + 1)))
# Judge status: Accepted
N,M = map(int,input().split())

if N % 2 == 1:
    for i in range(M):
        print(i+1,N-i)
else: #こっちに問題あり
    for i in range(M):
        if i<N//4:
            print(i+1,N-i)
        else:
            print(i+1,N-i-1)
# Judge status: Wrong Answer
S=input()

num0=0
num1=1

for i in range(len(S)):
    if S[i]=='0':
        num0+=1
    else:
        num1+=1
print(2*min(num0,num1))
# Judge status: Wrong Answer
K,N=map(int,input().split())
A=list(map(int,input().split()))
ans=0
ans+=min(abs(A[0]-A[-1]),abs(A[0]-A[1]))
for i in range(1,N-1):
    ans+=min(abs(A[i-1]-A[i]),abs(A[i]-A[i+1]))
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
S = input().split(" ")
print(S[1] + S[0])
# Judge status: Wrong Answer
def main():
    s = list(input())
    s = sorted(set(s))
    ans = 'None'
    if 'a' not in s:
        ans = 'a'
        print(ans)
        exit()
    for i in range(len(s)-1):
        if s[i] == 'z':
            break
        if ord(s[i])+1 != ord(s[i+1]):
            ans = chr(ord(s[i])+1)
            break
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a=[111,222,333,444,555,666,777,888,999]
i=0
n=int(input())
while a[i]<n:
    i=i+1
print(a[i])
# Judge status: Wrong Answer
arr = map(int,input().split())
print(sum(arr))
# Judge status: Accepted
a, b, k = map(int, input().split())

com_dev = [1]

for i in range(2, 101):
  
    if a % i == 0 and b % i == 0:
        com_dev.append(i)

print(com_dev[len(com_dev) - k])
# Judge status: Accepted
#17:23
x,y = map(int,input().split())
if (x+y) % 3 != 0:
  print(0)
elif x*2 < y or y*2 < x:
  print(0)
else:
  a = (x + y) // 3
  b = y - a
  mod = 10 ** 9 + 7
  def inv(x):
    y = 1
    while x != 1:
      y *= mod // x + 1
      y %= mod
      x -= mod % x
    return y
  ans = 1
  for i in range(b):
    ans *= a - i
    ans %= mod
    ans *= inv(b-i)
    ans %= mod
  print(ans)
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N = I()
A,B = [],[]  # x+y,x-y たちのリスト
for i in range(N):
    x,y = MI()
    A.append(x+y)
    B.append(x-y)

print(max(max(A)-min(A),max(B)-min(B)))