peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
import itertools
input = sys.stdin.readline

N = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)

bob_filter = [i % 2 for i in range(len(a))]
alice_filter = [not i for i in bob_filter]
result = sum(list(itertools.compress(a, alice_filter))) \
         - sum(list(itertools.compress(a, bob_filter)))
print(result)
# Judge status: Accepted
import sys

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


def main():
    s = list(input())
    k = int(readline())
    l = len(s)
    rem = k

    for i in range(l):
        char = s[i]
        diff = (ord("z") - ord(s[i]) + 1) % 26
        if rem >= diff:
            rem -= diff
            s[i] = "a"

    rem = rem % 26
    s[l - 1] = chr(ord(s[l - 1]) + rem)
    print("".join(s))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
list=input()
def split(a): 
    return [char for char in a]
list=split(list)
even_count=0
odd_count=0
for i in list:
  if even_count%2==0:
      even_count+=1
      continue
  if list[even_count]=="R":
    print("NO")
    sys.exit()
  even_count+=1
for i in list:
  if odd_count%2==1:
      odd_count+=1
      continue
  if list[odd_count]=="L":
    print("NO")
    sys.exit()
  odd_count+=1
print("YES")
# Judge status: Wrong Answer
N,M=map(int, input().split()) 
if M == 1:
    answer = N * N-1
elif N == 1:
    answer = M * M-1
else:
    answer = (N * (N-1))//2 + (M * (M-1))//2
print(answer)
# Judge status: Wrong Answer
X = int(input())
happiness = (X//500)*1000+((X%100)//5)*5
print (happiness)
# Judge status: Wrong Answer
cl = list(list(map(int, input().split())) for _ in range(3))
c_sum = 0
for c in cl:
    c_sum += sum(c)

count = 0
for i in range(2, c_sum+1):
    if c_sum % i == 0:
        count += 1

if count == 1:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
number = input().split(" ")
X = int(number[0])
Y = int(number[1])

if Y % 2 == 1:
    print("No")
else:
    if X * 4 >= Y:
        if X * 2 <= Y:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
# Judge status: Accepted
X,Y,Z=map(int,input().split())
print(X//(Y+Z) if (X%(Y+Z))>=Z else (X//(Y+Z))-1)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

wn = 0
hn = 0

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and wn < x:
        wn = x
    elif a == 2 and w > x:
        w = x        
    elif a == 3 and hn < y:
        hn = y
    elif a == 4 and h > y:
        h = y

if (w - wn) > 0 and (h - hn) > 0:
    print((w - wn) * (h - hn))
else:
    print(0)
# Judge status: Accepted
a = int(input())
ans = 0
b = 0
while ans <= a:
  b += 1
  ans = b**2
print((b-1)**2)
# Judge status: Wrong Answer
a, b = map(int, input().split())
 
if b > 13:
    print(a)
else:
    print(b)
# Judge status: Wrong Answer
a,b = map(int, input().split())

if a>b and b!=1:
    print("Alice")
elif a==1:
    print("Alice")
elif a==b:
    print("Draw")
else:
    print("Bob")
# Judge status: Wrong Answer
N = int(input())
A = input().split()

ss = 0
for i in range(N - 1):
    j = i +1
    ss += int(A[i]) * int(A[j])
ss += int(A[N -1])
print(ss % 1000000007)
# Judge status: Accepted
x=input().split()
dim=[int(x[0]),int(x[1]),int(x[2])]
if (dim[0]*dim[1]*dim[2])%2==0:
  print(0)
else:
  dim.remove(max(dim))
  print(dim[0]*dim[1])
# Judge status: Wrong Answer
s = list(input())

thresh_1 = int((len(s) - 1) / 2)
thresh_2 = int((len(s) + 3) / 2)

s_1 = s[:thresh_1]
s_2 = s[thresh_2 - 1:]
print(s_1)
print(s_2)
if s == s[::-1] and s_1 == s_1[::-1] and s_2 == s_2[::-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b = map(int, input().split())

if a * b > 0:
    ans = abs(b - a)
    if a > b:
        ans += 2

else:
    ans = abs(a - b)
    if a > b:
        ans += 1
    tmp = abs(abs(a) - abs(b)) + 1
    ans = min(ans, tmp)
    
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**10
for i in range(N-K+1):
    ans = min(ans, abs(x[i]) + abs(x[i] - x[i+K-1]))
    ans = min(ans, abs(x[i+K-1]) + abs(x[i+K-1] - x[i]))
print(ans)
# Judge status: Wrong Answer
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

oni = v*t + a
nige = w*t +b

if v and w >0:
    if oni > nige:
        print("YES")
    else:
        print("NO")
elif v and w <0:
    if oni < nige:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
import math

n, k = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]
h.sort()
ans = math.inf
for i in range(n - k + 1):
    ans = min(ans, h[i + k - 1] - h[i])

print(ans)
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]

t = []

for i in range(N)[::-1]:
	if i%2!=(N%2):
		t.append(A[i])

for i in range(N):
	if i%2==(N%2):
		t.append(A[i])



print(*t)
# Judge status: Accepted
g = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
x, y = map(int, input().split())
for i in range(len(g)):
    if x in g[i]:
        xg = i
    if y in g[i]:
        yg = i
if xg == yg:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a<b:
    print('unsafe')
else:
    print('safe')
# Judge status: Accepted
if input() == input()[::-1]:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
temp = int(input())
print("No" if temp >= 30 else "Yes")
# Judge status: Wrong Answer
n=int(input())
lista= [int(i) for i in input().split()]

len=len(lista)

ans=1

for i in range(1,len-1):
	if lista[i-1]>=lista[i]:
		ans=ans+1
		
print(ans)
# Judge status: Wrong Answer
s = input()
ans = 'No'

for i in range(len(s)):
    if i%2!=0 and s[i] == 'R':
        ans = 'Yes'
    elif i%2==0 and s[i] == 'L':
        ans = 'Yes'
print(ans)
# Judge status: Accepted
n=input()

l=[chr(ord('a') + i) for i in range(26)]
for k in l:
    if k not in n:
      print(k)
      exit()
print("None")
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
i = 0
while i < N-1:
  if A[i]+A[i+1] > x:
    d = A[i]+A[i+1]-x
    ans += d
    A[i+1] = 0 if A[i+1] < d else A[i+1]-d
  i += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = int(input())

q, r = divmod(n, 500)
if r <= a:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
h = H[-1]
ans = "Yes"
for i in range(N-1, -1, -1):
  if H[i] <= h+1:
    h = min(h, H[i])
  else:
    ans = "No"
    break
print(ans)
# Judge status: Accepted
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = list(map(int,input().split()))

B = [0]*(N+1)
Ans = []

for k in range(N,0,-1):
    cnt = 0
    for i in range(k,N+1,k):
        cnt += B[i]
    cnt %= 2
    if A[k-1] != cnt:
        B[k] = 1
        Ans.append(k)

print(len(Ans))
if Ans:
    print(*Ans)
# Judge status: Wrong Answer
n = int(input())
C = {}
for _ in range(n):
    a = input()
    if a not in C:
        C[a] = 0
    C[a] += 1
print(C)
for i in C.keys():
    C[i] %= 2
print(sum(C.values()))
# Judge status: Wrong Answer
n_k = list(map(int,input().split()))
chr_lr = list(input())
cnt_rl = 0
cnt_con = 0

for i in range(n_k[0]-1):
  if(chr_lr[i] == chr_lr[i+1]):
    cnt_con += 1
  elif(chr_lr[i] == 'R' and chr_lr[i+1] == 'L'):
    cnt_rl += 1

if n_k[1] <= cnt_rl:
  sum = cnt_con + (n_k[1]*2)
else:
  sum = cnt_con + (cnt_rl*2)

if(chr_lr[0] != chr_lr[n_k[0]-1]):
  sum += 1
  
print(sum)
# Judge status: Accepted
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
xyc = [[int(i) for i in input().split()] for _ in range(M)]
ans = min(a) + min(b)
for z in xyc:
    x, y, c = z
    ans = min(a[x - 1] + b[y - 1] - c, ans)
print(ans)
# Judge status: Wrong Answer
n = int(input())

if n == 0:
    print(0)
    exit()

s = ""

while True:
    if n == 0:
        break
    if n%2 == 0:
        s += "0"
        n = n//(-2)
    else:
        s += "1"
        n = (n-1)//(-2)

print(s)
# Judge status: Accepted
a = input()
if a.isupper():
    print("A")
else:
    print("a")
# Judge status: Accepted
n, d = map(int, input().split())
c = 0
while True:
  t = n-d
  n = t-d-1
  c += 1
  if n <= 0:
    break
print(c)
# Judge status: Accepted
s,w = map(int,input().split())
if w >= s:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
a = [int(input()) for i in range(3)]
print(int((a[0]+a[1])*a[2]/2))
# Judge status: Wrong Answer
n = int(input())
CSF = [tuple(map(int, input().split())) for _ in range(n - 1)]

for i in range(n):
    t = 0
    for c, s, f in CSF[i:]:
        if t < s:
            t = s
        else:
            t += t % f
        t += c
    print(t)
# Judge status: Accepted
s=input()
ans=""
for c in s:
  if c=='B':
    if ans:
      ans=ans[0:-1]
  else:
    ans+=c
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
print(min([x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1])) for i in range(n-k+1)]))
# Judge status: Wrong Answer
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
result = 'No'

if sum(c1[:2]) == c1[2] or c1[0] == c1[2]:
    if sum(c2[:2]) == c2[2] or c2[0] == c2[2]:
        if sum(c2[:2]) == c3[2] or c3[0] == c3[2]:
            result = 'Yes'

print(result)
# Judge status: Accepted
n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))
# Judge status: Accepted
n=int(input())
hl=list(map(int,input().split()))
count=0
temp_count=0
for i in range(n-1):
    if hl[i]>=hl[i+1]:
        temp_count+=1
    else:
        if count<temp_count:
          count=temp_count
        temp_count=0
if count<temp_count:
    count=temp_count
print(count)
# Judge status: Accepted
N,M = map(int,input().split())
rboxes = [False]*N
rboxes[0] = True
ballC = [1]*N
for i in range(M):
    x, y = map(int, input().split())
    if rboxes[x-1]:
        rboxes[y-1] = True
    ballC[x-1] -= 1
    ballC[y-1] += 1
    if ballC[x-1] == 0:
        rboxes[x-1] = False
c = 0
for i in range(N):
    if rboxes[i]:
        c+=1
print(c)
# Judge status: Wrong Answer
N,M = map(int, input().split())
A = []
B = []
tree = [[]] * N

for i in range(M):
    tempA,tempB = map(int, input().split())
    A.append(tempA)
    B.append(tempB)
    tree[tempA - 1] = tree[tempA - 1]+[tempB]
    tree[tempB - 1] = tree[tempB - 1]+[tempA]

for i in range(N):
    if i == 0:
        print("Yes")
        continue
    for i2,v in enumerate(tree):
        if i + 1 in v:
            print(i2 + 1)
            break
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print(a*b/2)
# Judge status: Accepted
N,A,B=map(int,input().split())
if (B-A)%2==0:
    ans=(B-A)//2
else:
    #2人のどちらかが卓1,Nのいずれかに到達するのに必要なラウンド数
    #1は偶奇を調整するためのラウンド
    #(B-A-1)/2は偶奇の調整後に2人が出会うまでのラウンド数
    ans=min(A-1,N-B)+1+(B-A-1)//2 
print(ans)
# Judge status: Accepted
a,b,c=map(int, input().split())
if (10*b+c)%4 == 0:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
N, K = map(int, input().split())
p = list(map(int,input().split()))

print(sum(list(set(p))))
# Judge status: Accepted
import random


S = input()
n = len(S)
i = 0+int(random.random()*(n-3))
print(S[i]+S[i+1]+S[i+2])
# Judge status: Wrong Answer
print('Possible' if sum(map(int, input().split()))%3==0 else 'Impossible')
# Judge status: Accepted
n, *a = map(int, open(0).read().split())
b = min(a)
print(4 + (n + b - 1) // b)
# Judge status: Accepted
x, y = map(int, input().split())
A = []
while (x <= y):
    A.append(x)
    x *= 2
print(len(A))
# Judge status: Accepted
MOD = 10**9+7

N = int(input())

ans = 1
for i in range(1,N+1):
    ans = (ans*i)%MOD
print(ans)
# Judge status: Wrong Answer
s = input()

if len(s)%2 != 0:
    print('No')
else:
    for x in range(0,len(s), 2):
        if s[x:x+2] != 'hi':
            print('No')
            exit()
print('Yes')
# Judge status: Wrong Answer
s = input()
s_len = len(s)
num = ''
ans = 0
j = 0
for i in range(s_len):
  while j < s_len:
    num += s[j]
    if int(num) % 2019 == 0:
      ans += 1
    j += 1
  j = i + 3
  if j > s_len:
    break
  num = ''
print(ans)
# Judge status: Accepted
from collections import Counter
n = int(input())
a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)

c = Counter(a)
ans = 0
loop = True
for i in c.values():
    x = 1
    while loop == True:
        if x * (x + 1) // 2 <= i < (x + 1) * (x + 2) // 2:
            break
        x += 1
    ans += x
print(ans)
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
 
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    S = {}
    for _ in range(N):
        s = input()
        if s not in S:
            S[s] = 1
        else:
            S[s] += 1

    v_max = max(S.values())
    keys = [k for k, v in S.items() if v == v_max]
    keys.sort()

    for k in keys:
        print(k)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n, result = map(int, input().split())

for x in range(n + 1):
  for y in range(n - x + 1):
    if 10000 * x + 5000 * y + 1000 * (n - x - y) == result:
      print(x, y, (n - x - y))
      exit()

print("-1,-1,-1")
# Judge status: Accepted
a, b, c = map(int, input().split())
if (c-a-b)**2 > 4*a*b and c-a-b>0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, X, Y = map(int, input().split())
dists = [0] * N
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = min(j - i, abs(X - i) + abs(Y - j) + 1)
        dists[d] += 1

for k in range(1, N):
    print(dists[k])
# Judge status: Wrong Answer
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())
N = int(input())
num = []
for _ in range(N):
  num.append(int(input()))

row1 = a11 + a12 + a13
row2 = a21 + a22 + a23
row3 = a31 + a32 + a33
col1 = a11 + a21 + a31
col2 = a12 + a22 + a32
col3 = a13 + a23 + a33
cross1 = a11 + a22 + a33
cross2 = a13 + a22 + a31

if 0 in [row1, row2, row3, col1, col2, col3, cross1, cross2]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,K = map(int,input().split())
a = 0
for i in range(1,N+1):
  nankai = 0
  while 2**(nankai)*i  < K  :
    nankai += 1
  a += 1/(N*(2**nankai))
print(a)
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
gap=abs(a-b) 
if v>w:
  c=gap/(v-w)
  if t>=c:
    print('YES')
  else:
    print('NO')
else:
  print('NO')
# Judge status: Accepted
inputs = input().split(' ')
inputs2 = input().split(' ')
inp1=[int(a) for a in inputs]
inp2=[int(a) for a in inputs2]

# inp1 = [12,3]
# inp2 = [4,56,78,901,2,345,67,890,123,45,6,789]


sums = sum(inp2)
rest = 1/(4*inp1[1])

inp2.sort()
inp2.reverse()

result = []

for i in range(inp1[1]):

	if inp2[i] > sums*rest or inp2[i] == sums*rest:
		result.append(int(inp2[i]))



if len(result)>inp1[1] - 1:
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
import sys
input=sys.stdin.readline

def atc(atc):
    result=["1","2","3","4","5","6","7","8","9","9","9","9","9","9","9","9","9"][atc//400]
    return result
num=0
L1=[]
n=int(input())
L=list(map(int,input().split()))
for i in L:
    a=atc(i)
    if a=="9":
        num+=1
    else:L1.append(a)
b=len(set(L1))
c=b+num
if c>9:
    c=9
else:c
print(b,c)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print(a*b*c//max(a,b,c))
# Judge status: Accepted
a, b =map(int,input().split())
cnt=[i for i in range(b-a)]
print(sum(cnt)-a)
# Judge status: Accepted
from decimal import*
from fractions import*
import math
import functools


import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inputt = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines 

s,t=input().split()
a,b=input().split()
u=input()
if(u==s):
    a=int(a)-1
else:
    b=int(b)-1
print(a,end=" ")
print(b)
# Judge status: Wrong Answer
N=list(input())

N.insert(0,0)
ans=0
for i in range(len(N)-1,-1,-1):
  n=int(N[i])
  if n//10>=1:
    N[i-1]=str(int(N[i-1])+1)
    continue
    
  if n==5:
    if int(N[i-1])>=4:
      N[i-1]=str(int(N[i-1])+1)
    ans+=5
  elif n>=6:
    ans+=10-n
    N[i-1]=str(int(N[i-1])+1)
  else:
    ans+=n
    
print(ans)
# Judge status: Accepted
N=int(input())
S=list()
for i in range(N):
    S.append(input())
M=int(input())
T=list()
for i in range(M):
    T.append(input())
A=set(S)
ans=0
for i in A:
    s=0
    s=S.count(i)-T.count(i)
    if s>ans:
        ans=s
print(ans)
# Judge status: Wrong Answer
def main():
    a, b = map(int, input().split())
    if a == 0 or b == 0: print("IMPOSSIBLE")
    else:print( int((a + b) / 2))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math
print(math.factorial(int(input())))
# Judge status: Wrong Answer


from itertools import permutations
from math import hypot, factorial

n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,y1,x2,y2: ((x1-x2)**2 + (y1-y2)**4)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / factorial(n))
# Judge status: Accepted
a,b,k = map(int,input().split())
c = 0
i = max(a,b)

while i > 0:
    if a % i == 0:
        if b % i == 0:
            c += 1

    if c == k:
        print(i)
        break

    i -= 1
# Judge status: Accepted
from operator import mul
from functools import reduce
import collections

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

N = int(input())
M = input().split()

c = collections.Counter(M)

A = 0

for i in c.values():
    if i >= 2:
        A += cmb(i, 2)
    
for j in M:
    print(A - (c[j]-1))
# Judge status: Accepted
import sys
input = sys.stdin.readline

S, T = input().rstrip().split()
A, B = [int(x) for x in input().split()]
U = input().rstrip()

if U == S:
    print(A - 1, B)
else:
    print(A, B - 1)
# Judge status: Accepted
A, B, C = list(map(int, input().split()))
K = int(input())
flag = False
for i in range(K):
    b = (2 ** i) * B
    c = (2 ** (K - i)) * C
    if A < b < c:
        flag = True
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a=int(input())
if a < 1000:
    print('ABC'+(str(a)))
elif len(str(a-999)) == 2:
    print('ABD'+'0'+(str(a-999)))
elif len(str(a-999)) == 1:
    print('ABD'+'00'+(str(a-999)))
else:
    print('ABD'+(str(a-999)))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
n=a//c
y=b//c
x=y-n
if n//c==0 or y//c==0:
    print(x+1)
else:
    print(x)
if c==1:
    print(x+1)
# Judge status: Accepted
import numpy as np
a, b, c, d = map(int, input().split())

hoge = []
hoge.append(a*c)
hoge.append(a*d)
hoge.append(b*c)
hoge.append(b*d)

print(max(hoge))
# Judge status: Accepted
import math

def main():
    a,b,x=map(int,input().split())
    if a**2*b/2<x :
        theta=math.atan(2*(a**2*b-x)/a**3)
    else :
        theta=math.pi/2-math.atan(2*x/(a*b**2))
    print(theta*180/math.pi)

main()
# Judge status: Wrong Answer
N,M = map(int, input().split())
d = ['x']*N

flg = 0
for i in range(M):
  s,c = map(int, input().split())
  s -= 1
  if d[s] == 'x':
    d[s] = c
  if d[s] != c or (s==0 and c==0 and N>1):
    flg = -1

ans = 0
for j in range(N):
  N-=1
  if d[j]=='x':
    if j == 0:
      d[j] = 1
    else:
      d[j] = 0
  ans += d[j]*(10**N)

print(flg if flg == -1 else ans)
# Judge status: Accepted
cin = open(0).read().strip().split('\n')
n = int(cin[0])
xy = [tuple(map(int, a.split(' '))) for a in cin[1:]]

import itertools, math

ret = 0
case = 0
for cases in itertools.permutations(xy):
    case += 1
    for idx in range(n-1):
        ret += math.sqrt((cases[idx][0]-cases[idx+1][0])**2 + (cases[idx][1]-cases[idx+1][1])**2)

print(ret/case)
# Judge status: Accepted
N=int(input())
sum=0
for i in range(N):
    sum+=i+1
    if sum>=N:
        break
for j in range(1,i+2):
    if j!=sum-N:
        print(j)
# Judge status: Accepted
# A - Right Triangle
a,b,c=list(map(int,input().split()))
print((a*b)//2)
# Judge status: Accepted
S = input()
N = len(S)

for i in range(N-1,0,-1):
  if i % 2 == 1:
    continue
  if S[:i//2] == S[i//2:i]:
    ans = i
    break
    
print(ans)
# Judge status: Accepted
import math
n = int(input())

print(math.ceil(n/2))
# Judge status: Wrong Answer
s = input()

c = []
x = ["A","G","C","T"]


for i in range(0,len(s)-1):
  if(s[i] in x):
    t = 1
    for j in range(i+1,len(s)):
      if(s[j] in x):
        t = t + 1
      elif(s[j] not in x or j == len(s)):
        c.append(t)
if(len(c)==0):
  c.append(0)
print(max(c))
# Judge status: Wrong Answer
s = list(map(int, input().split('/')))

if s[1] > 5:
    print('TBD')
elif s[1] <= 4:
    print('Heisei')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a+2*b>=c:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, L = map(int, input().split())
ans = 0
for i in range(1, N):
	ans += L + i
print(ans)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

X = ins()


def solve():
    ans = sum([int(d) for d in X])

    ans = max(ans, int(X[0]) - 1 + 9 * (len(X) - 1))

    return ans


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

ans = []

for i in colors:
    if not i in ans:
        ans.append(i)

print(len(ans))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ans = 0
num = sum(A)
for i in range(N - 1):
  num -= A[i]
  ans += A[i] * num
print(ans % (10 ** 9 + 7))
# Judge status: Accepted
from collections import defaultdict
N = int(input())
S = input()
mod = 10 ** 9 + 7
d = defaultdict(int)
char = [chr(ord("a") + i) for i in range(26)]
ans = 1
for s in S:
    d[s] += 1
for v in d.values():
    ans *= v + 1
    ans %= mod
print(ans - 1)
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())
print(A - B if K % 2 == 1 else B - A)
# Judge status: Accepted
from collections import defaultdict, deque

N, M = map(int, input().split())
edges = defaultdict(list)
for _ in range(M):
    a, b = map(lambda x:int(x)-1, input().split())
    edges[a].append(b)
    edges[b].append(a)

go_to = [None] * N

q = deque()
q.append((0, -1))
is_visited = set()

while q:
    node, prev = q.popleft()
    if node in is_visited:
        continue
    is_visited.add(node)
    go_to[node] = prev + 1
    for dest in edges[node]:
        q.append((dest, node))

print('Yes')
for i in range(1, N):
    print(go_to[i])
# Judge status: Wrong Answer
import collections
import sys
a,b,c= map(int,input().split())
if c!=1:
    print(b//c-a//c)
else:
    print(b-c+1)
# Judge status: Accepted
def main():
    n = int(input())
    nums = [0]
    for i in range(1, n + 1):
        d = i
        count = 0
        while d != 0:
            d, amari = divmod(d, 2)
            if amari != 0:
                break
            count += 1
        nums.append(count)
    if n == 1:
        print(1)
    else:
        print(nums.index(max(nums)))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from collections import defaultdict
n, m = map(int, input().split())
ans = defaultdict(int)
for _ in range(m):
    a, b = map(int, input().split())
    ans[a - 1] += 1
    ans[b - 1] += 1
for _, v in sorted(ans.items()):
    print(v)