peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
input = sys.stdin.readline
def main():
  n=int(input())
  #a=list(map(lambda x:list(map(int,list(bin(int(x))[2:]))),input().split()))
  a=list(map(int,input().split()))
  mod=pow(10,9)+7
  bit=[0]*61
  for ai in a:
    for j in range(61):
      if ((ai>>j)&1):
        bit[j]+=1
  ans=0
  for i in range(61):# 2^iの位
    ans+=(pow(2,i,mod)*bit[i]*(n-bit[i]))%mod
    ans%=mod
  print(ans)
if __name__=='__main__':
  main()
# Judge status: Wrong Answer
import sys
import bisect
input = sys.stdin.readline

n, c, k = [int(w) for w in input().split()]
la = [int(input()) for _ in range(n)]
la.sort()
lak = [a + k for a in la]

ind = 0
ans = 0
while ind < n:
    ride = bisect.bisect_right(la, lak[ind]) - ind

    ind += min(ride, k)
    ans += 1

print(ans)
# Judge status: Wrong Answer
N = int(input())
S = str(input())

cnt=0
if N%2==1:
    print('No')
else:
    for i in range(int(N/2)):
        if S[i]==S[int(N/2)+i]:
            cnt+=1
        else:
            print('No')
            break
if cnt==int(N/2):
    print('Yes')
# Judge status: Wrong Answer
x=int(input())
n = x//100
k = x %100
if n >= 101 :
    print(1)
elif n*1 <= k <= n*5:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
city = {}
for i in ab:
  for j in i:
    if j not in city:
      city[j] = 1
    else:
      city[j] += 1
for number in range(n):
  if number in city:
    print(city[number])
  else:
    print(0)
# Judge status: Accepted
import math

r = int(input())
print(math.ceil(2*math.pi*r*100)/100)
# Judge status: Accepted
n = int(input())
point_dict1 = {}
point_dict2 = {}
for i in range(n):
    x, y = map(int, input().split())
    point_dict1[x + y] = (x, y)
    point_dict2[y - x] = (x, y)
min_point1 = min(point_dict1)
max_point1 = max(point_dict1)
min_point2 = min(point_dict2)
max_point2 = max(point_dict2)
print(max(max_point1 - min_point1, max_point2 - min_point2))
# Judge status: Accepted
from math import sqrt
N, D = map(int, input().split())
X_list = [input().split() for i in range(N)]
cnt = 0
for x in range(N-1):
    d = 0
    tmp = 0
    for y in range(x+1, N):
        d = 0
        tmp = 0
        while d < D:
            x_d = int(X_list[x][d])
            y_d = int(X_list[y][d])
            tmp += (x_d - y_d) ** 2
            d += 1
        if sqrt(tmp).is_integer():
            cnt += 1

print(cnt)
# Judge status: Accepted
ABC = list(map(int, input().split()))

ABC.sort(reverse=True)

print(int(''.join(map(str, ABC[:2]))) + int(ABC[-1]))
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]

L, R = [A[-1]], [A[-1]]
for i in range(1, N+1):
    L.append((L[-1]+1)//2+A[-1-i])
    R.append((R[-1]+A[-1-i]))
L = L[::-1]
R = R[::-1]

if L[0] >= 2:
    print(-1)
    exit()

ans = 1
p = 1
for i in range(1, N+1):
    ans += min(p*2, R[i])
    p = min(p*2, R[i])-A[i]
print(ans)
# Judge status: Wrong Answer
a = int(input())
b = list(map(int,input().split()))
b.sort()
ans = 0
n = b[0]
while n % 2 ==0:
	ans +=1
	n = n/2
print(ans)
# Judge status: Wrong Answer
n = int(input())
li = []
for i in range(5):
    a = int(input())
    li.append(a)
li.sort()
if n//li[0] >= 1:
    print(n//li[0] + 5)
else:
    print(5)
# Judge status: Accepted
n,m=map(int,input().split())
if 0<n<10 and 0<m<10:
  print(n*m)
else:
  print(-1)
# Judge status: Wrong Answer
A=list(input())
A.sort()#sortメソッドは破壊的
print("Yes" if A[1]!=A[2] else "No")
# Judge status: Wrong Answer
N = int(input())

if N > 81:
    print('No')
else:
    for i in range(1, 10):
        for j in range(1, 10):
            if N == i * j:
                print('Yes')
                exit()

print('No')
# Judge status: Accepted
N=int(input())
S=[""]*N
T=[""]*N
for i in range(N):
  S[i]=list(input().split())
  S[i][1]=-int(S[i][1])
  T[i]=S[i]
S.sort(key=lambda x:(x[0],x[1]))
for i in range(N):
  for j in range(N):
      if(T[j]==S[i]):
        print(j+1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
box = [0] * n
ans = []

for i in range(n-1, -1, -1):
    ms = sum(box[i::i+1])
    if ms % 2 != a[i]:
        box[i] = 1
        ans.append(i+1)

print(len(ans))
print(*ans)
# Judge status: Wrong Answer
def main():
    n, k = map(int, input().split())

    print(n%k)

if __name__ == '__main__':
    main()
# Judge status: Accepted
x, n = map(int, input().split())
ps = list(map(int, input().split()))

for i in range(101):
    sub = x - i
    if sub not in ps:
        print(sub)
        break

    add = x + i
    if add not in ps:
        print(add)
        break
# Judge status: Wrong Answer
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='Yes'
if a[1]-a[0]!=b[1]-b[0] or a[2]-a[1]!=b[2]-b[1]:
  ans='No'
elif b[0]-a[0]!=b[1]-a[1] or  b[2]-a[2]!=b[1]-a[1]:
  ans='No'
elif c[0]!=a[2]+b[0] or c[1]!=a[2]+b[1] or c[2]!=a[2]+b[2]:
  ans='No'
print(ans)
# Judge status: Accepted
def searchstring(s) : 
  start = ord('a')
  end = ord('z')
  stringlist = [0] * 256
  for i in range(len(s)) : 
    stringlist[ord(s[i])] += 1
  for i in range(start, end + 1) : 
    if stringlist[i] == 0 : 
      return chr(i)
  return None



s = input()

print(searchstring(s))
# Judge status: Wrong Answer
n = int(input())
if(n == 1):
  print(0)
elif(n==2):
  print(2)
else:
  print((n*(n-1)+10**(n-2))%(10**9+7))
# Judge status: Wrong Answer
import fractions
a, b, c, d = map(int, input().split())
ans = 0

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

def k(x):
    return x - (x//c + x//d - x//lcm(c, d))

print(k(b)-k(a))
# Judge status: Wrong Answer
N = int(input())
x,y = map(int,input().split())
minx, miny = x,y
maxx, maxy = x,y
maxdist = 0
for i in range(N-1):
  x,y = map(int,input().split())
  dist1 = abs(minx - x) + abs(miny - y)
  dist2 = abs(maxx - x) + abs(maxy - y)
  if dist1 > maxdist:
    maxx = x
    maxy = y
    maxdist = dist1
  elif dist2 > maxdist:
    minx = x
    miny = y
    maxdist = dist2
    
print(maxdist)
# Judge status: Accepted
N = int(input())
a = [[0 for _ in range(10)] for _ in range(10)]
ans = 0

for i in range(1, N+1):
    a[int(str(i)[0])][int(str(i)[-1])] += 1

for i in range(10):
    for j in range(10):
        ans += a[i][j]*a[j][i]

print(ans)
# Judge status: Accepted
print('YES' if int(input())in[3,5,7] else 'NO')
# Judge status: Wrong Answer
N,M = map(int,input().split())

Turm = []

num  = []

for i in range(N):
    num.append([])

for i in range(M):
    n,v = map(int,input().split())
    Turm.append((n,v))
    num[n-1].append(v)
for i in range(N):
    num[i].sort()
for n,v in Turm:
    print('00000'+str(n)[-6::],'00000'+str(num[n-1].index(v)+1)[-6::])
# Judge status: Accepted
a,b,c = input().split()

ans = "A" + b[0] + "C"
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
aa = [a[0] % mod]
for i in range(1, n-1):
    aa.append((aa[i-1] + a[i]) % mod)
ans = 0
for i in range(n-1):
    ans += ((aa[i] * a[i+1]) % mod)
print(ans % mod)
# Judge status: Accepted
# input
N = int(input())
A = list(map(int, input().split()))

# check
res = 0
Alice_Turn = True
while A:
    max_a = max(A)
    if Alice_Turn:
        res += max_a
        Alice_Turn = False
    else:
        res -= max_a
        Alice_Turn = True
    A.remove(max_a)

print(res)
# Judge status: Accepted
import math
from functools import reduce

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

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

def lcm(target_list):
  return reduce(lcm_base, target_list)

A_gcd = reduce(math.gcd, A)
flg = True

for a in A:
  if a//A_gcd%2==0:
    flg = False
    break
    
if flg:
  min_x = int(lcm(A))//2
  ans = m//min_x - m//(2*min_x)
  print(ans)
else:
  print(0)
# Judge status: Wrong Answer
def main():
    K, N = map(int, input().split())
    A = list(map(int, input().split()))

    shiftA = A[1:] + [K]

    subA = [shiftA[i] - A[i] for i in range(N)]
    maxA = max(subA)
    subA.remove(maxA)

    print(sum(subA))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = [i*4 for i in range(n//4 + 1)]
b = [i*7 for i in range(n//7 + 1)]

c =set()
for i in a:
    for j in b:
        if i+j != 0 and i+j <=n:
            c.add(i+j)
            
if n in c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x = input()
if int(x) == 1:
 print("0")
else:
 print("1")
# Judge status: Accepted
s = input()
t = input()
 
flag = True
for i in range(len(s)):
  if s[i] is not t[i]:
    flag = False
if flag is True:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def inpl():
    return list(map(int, input().split()))


A = inpl()
A.sort()
print("Yes" if A[0] != A[2] and (A[0] == A[1] or A[1] == A[2]) else "No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
x,y=[],[]

for i in range(n):
  x.append(input())

for i in range(m):
  y.append(input())

for i in range(n-m+1):
  for j in range(n-m+1):
    if x[i][j]==y[0][0]:
      if m==1:
        print('Yes')
        exit()
      for k in range(m):
        if x[i+k][j:j+n-m+1]!=y[k]:
          continue
          
        print('Yes')
        exit()
        
print('No')
# Judge status: Wrong Answer
def mi():
    return map(int, input().split())
'''
3 4
*G*S
G**S
*G*S
'''
n,m = mi()
l = -1
r = 1e10
for i in range(m):
    a,b=mi()
    l = max(l,a)
    r = min(r,b)
print(r-l+1)
# Judge status: Accepted
a, b, c = map(str, input().split())
max = int(a+b) + int(c)
if max < int(a) + int(b+c):
    max = int(a) + int(b+c)

elif max < int(c+a) + int(b):
    max = int(c+a) + int(b)
print(max)
# Judge status: Accepted
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,*a = map(int,read().split())

MOD = 10**9+7
i2 = (MOD+1)//2


r = sum(a)
r *= r
r -= sum(i*i for i in a)

r *= i2
print(r%MOD)
# Judge status: Accepted
n, m = map(int, input().split())
a = [" "] * n
for i in range(n):
    a[i] = input()
b = [" "] * m
for i in range(m):
    b[i] = input()

flag = False
for i in range(n-m+1):
    if flag: break
    for j in range(n-m+1):
        suba = a[i:i+m]
        for k in range(len(suba)):
            suba[k] = suba[k][j:j+m]
        if suba == b:
            flag = True
            break

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from functools import reduce
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

C = list(set(A))

lcm = A[0]
for i in range(1, len(C)):
    lcm = lcm * C[i] // gcd(lcm, C[i])

MOD = 10 ** 9 + 7
ans = 0
for i, a in enumerate(A):
    ans += lcm // a
    ans %= MOD

print(ans)
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(input())

s.sort()
cnt = Counter(s).most_common()

print(cnt[0][0])
if len(cnt) > 1:
    for i in range(1, n):
        if cnt[i-1][1] == cnt[i][1]:
            print(cnt[i][0])
        else:
            break
# Judge status: Accepted
n = int(input())
data = []
for i in range(n-1):
    c,s,f = map(int,input().split())
    s //= f
    data.append((c,s,f))
for i in range(n):
    if i == n-1:
        print(0)
        break
    for j in range(i,n-1):
        if j == i:
            ans = data[j][0]+data[j][1]*data[j][2]
            continue
        ans = (max((ans-1)//data[j][2]+1,data[j][1])*data[j][2]) + data[j][0]
    print(ans)
# Judge status: Accepted
N, K = map(int, input().split())

x = abs(N -(N//K)*K)
y = abs(N - (N//K + 1)*K)

if x < y:
    print(x)
else:
    print(y)
# Judge status: Accepted
from collections import Counter


MOD = 998244353
N = int(input())
D = list(map(int, input().split()))
cnt_D = Counter(D)
if D[0] != 0 or cnt_D.get(0, 0) != 1:
    print(0)
else:
    prev = 1
    ans = 1
    for i in range(1, max(D) + 1):
        v = cnt_D.get(i, 0)
        ans *= pow(prev, v, MOD)
        ans %= MOD
        prev = v
    print(ans)
# Judge status: Wrong Answer
import random

S = str(input())

A = list(S)

N = random.sample(A, k=3)

print(N[0]+N[1]+N[2])
# Judge status: Wrong Answer
import itertools
N=int(input())
I=[str(i) for i in range(1,N+1)]
P=''.join(input().split())
Q=''.join(input().split())
li=list(itertools.permutations(I,N))

a=0
b=0
for i in range(len(li)):
    if(''.join(li[i])==P):
        a=i+1
    elif(''.join(li[i])==Q):
        b=i+1
print(abs(b-a))
# Judge status: Accepted
n, k = [int(v) for v in input().split()]
rate = []
for i in range(1, n + 1):
    if i >= k:
        rate.append(1)
        continue

    for s in range(1, k):
        score = i * (2 ** s)
        if score >= k:
            rate.append(1 / (2 ** s))
            break

print(sum(rate) / len(rate))
# Judge status: Accepted
A, B, C, D = map(int, input().split())
if A <= 0 <= B or C <= 0 <= D:
    x = 0
else:
    x = -float('inf')

print(max(A * C, B * D, A * D, B * C, x))
# Judge status: Accepted
n,k = map(int, input().split())
p = list(map(int, input().split()))
b = p[:k]
#print(b)
for i in range(k):
    b[i] = (b[i]+1)/2
a = sum(b)
a_max = sum(b)
#print(a)
for i in range(n-k):
    a -= (p[i]+1)/2
    a += (p[i+k]+1)/2
    if (a > a_max):
        a_max = a
print(a_max)
# Judge status: Wrong Answer
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=int(0)
count=int(1)
for i in range(N-1):
  D+=L[i]
  if D<=X:
    count+=1
  else:
    break
print(count)
# Judge status: Wrong Answer
n, k = map(int, input().split())

a = [0] + list(map(int, input().split()))
a1 = [0] * (n+1)

step = 1
start = 0
while(True):
    start += 1
    a1[step] += 1
    step = a[step]
    if a1[step] == 1:
        break
c = step
gap = 0
while(True):
    gap += 1
    step = a[step]
    if step == c:
        break
k = (k+n*gap-start) % gap
result = c
for _ in range(k):
    result = a[result]

print(result)
# Judge status: Accepted
N,K=map(int,input().split())
L=list(map(int,input().split()))
ans=float("inf")
for i in range(N-K+1):
	ans=min(ans,abs(L[i])+abs(L[i+K-1]-L[i]),abs(L[i+K-1])+abs(L[i+K-1]-L[i]))
print(ans)
# Judge status: Accepted
N = int(input())
min = N//4+1
count = 0
for i in range(min):
    for j in range(min):
        cost = i*4+j*7
        if cost == N:
            count += 1
        else:
            continue

if count >= 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, m =map(int, input().split())
H=list(map(int, input().split()))
cnt=[0]*n

for i in range(m):
	a, b = map(int, input().split())
	if H[a-1]>H[b-1]:
		cnt[b-1]+=1
	elif H[b-1]>H[a-1]:
		cnt[a-1]+=1
	else:
		cnt[a-1]+=1
		cnt[b-1]+=1

print(cnt.count(0))
# Judge status: Accepted
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
l = [(l[i] - (i + 1)) for i in range(n)]
l = list(map(abs, l))
a = int(sum(l)/n)
s = [abs(l[i] - a - 1) for i in range(n)]
l = [abs(l[i] - a) for i in range(n)]

print(sum(l) if sum(l) < sum(s) else sum(s))
# Judge status: Accepted
s = input()

if s > "2019/04/30":
    print("TBD")
else: print("Heisei")
# Judge status: Accepted
s=input()
li=[]
result='yes'
for i in s:
    if i in li:
        result='no'
    li.append(i)
print(result)
# Judge status: Accepted
a, b = map(int, input().split())
if a%3 == 0 or b%3==0 or (a+b)%3==0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
K = int(input())

tmp = 7
for i in range(K):
    if tmp%K == 0:
        print(i+1)
        exit()
    tmp = (tmp*10+7)%K

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

if N == 2:
    print(max(A))
    exit(0)

A.sort(reverse=True)

ans = A[0]
cur = 1
for ix in range(len(A[2:])):
    ans += A[cur]
    if ix & 1:
        cur += 1

print(ans)
# Judge status: Accepted
def solve():
    N = int(input())
    ans = ['a']
    for i in range(N - 1):
        newest_ans = []
        for a in ans:
            A = [ord(b) for b in a]
            for t in range(min(A), max(A) + 2):
                newest_ans.append(a + chr(t))
        ans = newest_ans
    for a in sorted(ans):
        print(a)


if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
a=input()
flg=0
for i in range(len(a)//2):
  if not a[2*i]=='h' and a[2*i+1]=='i':
  	flg=1   
if len(a)%2!=0 or flg==1:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
a=list(input())
s=''
 
for i in a:
    if i == '0':
        s=s+'0'
    elif i == '1':
        s=s+'1'
    else:
        s=s[0:-1]
    
print(s)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (a+b)%2==0:
  print('Even')
else:
  print('Odd')
# Judge status: Accepted
import itertools

A = range(int(input()) + 1)
B = range(int(input()) + 1)
C = range(int(input()) + 1)
X = int(input())

count = 0
for i in itertools.product(A, B, C):
  if i[0] * 500 + i[1] * 100 + i[2] * 50 == X:
    count += 1
print(count)
# Judge status: Wrong Answer
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 i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
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)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
K = i()
m = max(A,B,C)
ans = A+B+C+m*(2*K-1)
print(ans)
# Judge status: Accepted
t = input()
ans = t.replace('?','D')
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
a, b = min(a,b), max(a,b)
if a==1 and b==1:
    print(1)
elif a == 1:
    print(b-2)
elif a == 2:
    if b == 2:
        print(0)
    else:
        print(4)
else:
    print(  (a-2) * (b-2))
# Judge status: Accepted
n,k=map(int,input().split())
pp=list(map(int,input().split()))
pp.sort()
#print(pp)
count=0
for i in range(k):
  count+=pp[i]
print(count)
# Judge status: Wrong Answer
S = input()
T = input()

def match(k):
    flag = True
    for i in range(len(T)):
        if S[i+k] != T[i] and S[i+k]!="?":
            flag = False
            break
    return flag

flag = False
for k in range(len(S)-len(T)+1):
    # print(k)
    if match(k):
        S = S[:k] + T + S[k+len(T):]
        flag = True
    
if flag:
    ans = S.replace("?","a")

if not flag:
    ans = "UNRESTORABLE"

print(ans)
# Judge status: Accepted
n = int(input())
XY = [tuple(map(int, input().split())) for _ in range(n)]

# 左下右上
mi = min(XY, key=lambda x: x[0] + x[1])
ma = max(XY, key=lambda x: x[0] + x[1])
ans1 = ma[0]-mi[0] + ma[1]-mi[1]

# 左上右下
mi = min(XY, key=lambda x: x[0] + (10**9)-x[1])
ma = min(XY, key=lambda x: (10**9)-x[0] + x[1])
ans2 = abs(ma[0]-mi[0]) + abs(ma[1]-mi[1])
print(max(ans1, ans2))
# Judge status: Accepted
# https://atcoder.jp/contests/abc051/tasks/abc051_c
sx, sy, tx, ty = map(int, input().split())

ans = []
ans.append('R' * (tx - sx) + 'U' * (ty - sy))
ans.append('L' * (tx - sx) + 'D' * (ty - sy))
ans.append('D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L')
ans.append('U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R')
print(''.join(ans))
# Judge status: Accepted
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline

    n = int(input().rstrip())

    s_list = [input().rstrip() for _ in range(n)]

    from collections import Counter
    c = Counter(s_list)

    max_count = c.most_common()[0][1]

    words = [word for word, count in c.most_common() if count == max_count]
    words.sort()
    print("\n".join(words))




if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())

d=a//b

if d>=c:
  print(c)
else:
  print(d)
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n==m:
    temp=1
    for i in range(1,n+1):
      temp=(temp*i)%(10**9+7)
    print((2*((temp*temp)%(10**9+7)))%(10**9+7))
elif abs(n-m)==1:
    temp1=1
    temp2=1
    for i in range(1,n+1):
        temp1=(temp1*(i%(10**9+7)))%(10**9+7)
    for j in range(1,n+1):
        temp2=(temp2*(j%(10**9+7)))%(10**9+7)
    print((temp1+temp2)%(10**9+7))
else:
    print(0)
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
num = 0
for i in A:
    num += i
if A[M-1] >= num//4*M:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))

dictS={}
dictS[0]=1

P=180*170141183460469231731687303715884105727**2+1
# P=10**9+7


for n in range (1,N+1):
    if n-1<K:
        dictS[n]=(A[n-1]*dictS[n-1])%P
    else:
        dictS[n]=(A[n-1]*dictS[n-1]/A[n-1-K])%P

    if n>K:
        if dictS[n]>dictS[n-1]:
            print('Yes')
        else:
            print('No')
# Judge status: Accepted
n=int(input())
ans=[]
def rec(i,s):
    if i == n:
        print(s)
        return
    else:
        for j in range(len(set(s)) + 1):
            rec(i+1,s+chr(ord("a")+j))
rec(1,"a")
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
sunuke = 0
arai = sum(a)
p = []
for i in range(len(a)-1):
  sunuke += a[i]
  arai -= a[i]
  p.append(abs(sunuke - arai))

print(min(p))
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = {}
for i in range(n):
    if a[i] in s.keys():
        s[a[i]] = s[a[i]] + 1
    else:
        s[a[i]] = 1

print(s)
cnt = 0
while len(s) > k:
    cnt = cnt + min(s.values())
    s.pop(min(s, key=s.get))
print(cnt)
# Judge status: Accepted
from decimal import Decimal

A, B = input().split()
A = Decimal(A)
B = Decimal(B)
ans = A * B
print(int(ans))
# Judge status: Wrong Answer
import sys

n, a, b, c, d = map(int, input().split())
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = input()

flg = False
for i in range(a, d + 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        sys.exit()

for i in range(b, d):
    if 0 < i and i + 1 < n:
        if s[i - 1] == '.' and s[i] == '.' and s[i + 1] == '.':
            flg = True

if c < d:
    print('Yes')
else:
    if flg:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
s = input()
if s[0::3] <= "2019" and s[5::6] <= "04" and s[8::9] <= "30":
  print("Heisei")
else:
  print("TBD")
# Judge status: Accepted
N = int(input())
P = [int(input()) for _ in range(N)]

POINT = [False] * (10 ** 4 + 101)
POINT[0] = True
LP = len(POINT)

for p in P:
  for i in range(10**4,-1,-1):
    POINT[i+p] = POINT[i] | POINT[i+p]
  
ans = 0
for i in range(LP):
  if POINT[i] and i % 10 != 0:
    ans = max(i,ans)
    
print(ans)
# Judge status: Wrong Answer
# AtCoder
A, B = map(int, input().split())
ans = A + B
if ans > 24:
    ans = ans - 24
print(ans)
# Judge status: Accepted
a = input()
b = input()
c = input()

d = 'A'
while True:
  if d == 'A':
    if len(a) == 0:
      break
    s = a[0]
    a = a[1:]
  elif d == 'B':
    if len(b) == 0:
      break
    s = b[0]
    b = b[1:]
  else:
    if len(c) == 0:
      break
    s = c[0]
    c = c[1:]
  if s == 'a':
    d = 'A'
  elif s == 'b':
    d = 'B'
  else:
    d = 'C'
print (d)
# Judge status: Accepted
n = int(input())
a = 10**9+7
def mod(i,j):
    ans = 1
    for _ in range(j):
        ans = (ans*i)%a
    return(ans)

print(((mod(10,n)-mod(9,n)*2+mod(8,n))%a))
# Judge status: Accepted
h,w = map(int,input().split())
if (w == 2 or h == 2):
    print(0)
else:
    print(max(1,h-2)*max(1,w-2))
# Judge status: Wrong Answer
n=int(input())
s=str(input())
s=list(s)
tempw=s.count("W")
ans=n-tempw
if s[0]=="W":
  ans=ans-1
cnt=n-tempw
for i in range(1,n):
  if s[i-1]=="W":
    cnt=cnt+1
  if s[i]=="E":
    cnt=cnt-1
  ans=min(ans,cnt)  
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
color = [0]*8
nizi = 0
for i in range(n):
         if a[i] >= 3200:
                  nizi += 1
         else:
                  if color[a[i]//400] == 0:
                           color[a[i]//400] += 1
print(max(1,sum(color)),min(8,sum(color) + nizi))