Input:
import sys

input = sys.stdin.readline

def main():

    ans = 0

    n = int(input())

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

    l = [0]*n

    for i in range(n):

        l[o[i]-1] = i+1

    for i in range(len(l)):

        if  i != len(l)-1:

            print("{} ".format(l[i]), end='')

        else:

            print(l[i])

if __name__ == '__main__':

    main()

import sys

input = sys.stdin.readline

def main():

    ans = 0

    n = int(input())

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

    l = [0]*n

    for i in range(n):

        l[o[i]-1] = i+1

    print((" ".join(map(str,l))))

if __name__ == '__main__':

    main()

import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    o = list(map(int, input().split()))
    l = [0] * n
    for i in range(n):
        l[o[i] - 1] = i + 1
    for i in range(len(l)):
        if i != len(l) - 1:
            print("{} ".format(l[i]), end="")
        else:
            print(l[i])

if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    o = list(map(int, input().split()))
    l = [0] * n
    for i in range(n):
        l[o[i] - 1] = i + 1
    print((" ".join(map(str, l))))

if __name__ == "__main__":
    main()

-            print("{} ".format(l[i]), end="")


Input:
N,L = list(map(int, input().split()))

taste = [L+i-1 for i in range(1,N+1)]

if taste[-1] < 0:

  print((sum(taste) + min([abs(x) for x in taste])))

else:

  print((sum(taste) - min([abs(x) for x in taste])))

N, L = list(map(int, input().split()))

taste = [L+i-1 for i in range(1, N+1)]

if 0 in taste:

    select = 0

else:

    select_with_ind = min(enumerate(taste), key = lambda x: abs(x[1]))

    select = select_with_ind[1]

print((sum(taste) - select))

N, L = list(map(int, input().split()))
taste = [L + i - 1 for i in range(1, N + 1)]
if taste[-1] < 0:
    print((sum(taste) + min([abs(x) for x in taste])))
else:
    print((sum(taste) - min([abs(x) for x in taste])))

N, L = list(map(int, input().split()))
taste = [L + i - 1 for i in range(1, N + 1)]
if 0 in taste:
    select = 0
else:
    select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))
    select = select_with_ind[1]
print((sum(taste) - select))

-    print((sum(taste) + min([abs(x) for x in taste])))

-    print((sum(taste) - min([abs(x) for x in taste])))

+    select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))


Input:
# ABC090B - Palindromic Numbers

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

count = 0

for i in range(a, b + 1):

    lst = list(map(int, list(str(i))))

    if lst[0] == lst[4] and lst[1] == lst[3]:

        count += 1

print(count)

# ABC090B - Palindromic Numbers

def main():

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

    cnt = 0

    for i in range(a, b + 1):

        s = str(i)

        if s == s[::-1]:

            cnt += 1

    print(cnt)

if __name__ == "__main__":

    main()

-a, b = list(map(int, input().rstrip().split()))

+    a, b = list(map(int, input().rstrip().split()))


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

dp = [0] * n

for i in range(m):

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

    dp[x - 1] += 1

    dp[y - 1] += 1

for i in range(n):

    print((dp[i]))

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

A = [0] * n

for i in range(m):

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

    A[a - 1] += 1

    A[b - 1] += 1

for i in range(n):

    print((A[i]))

-    x, y = list(map(int, input().split()))

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


Input:
import math

n = int(input())

print((math.factorial(n) % (10**9 + 7)))

n = int(input())

ans = 1

for i in range(1, n+1):

    ans *= i

    ans %= 10**9 + 7

print(ans)

n = int(input())
ans = 1
for i in range(1, n + 1):
    ans *= i
    ans %= 10**9 + 7
print(ans)

-print((math.factorial(n) % (10**9 + 7)))


Input:
def factorial(N):

    power_r = 1

    for n in range(2,N+1):

        power_r *= n

        power_r %= 10**9+7

    return power_r

if __name__ == '__main__':

    N = int(input())

    print((factorial(N)))

def factorial(N):

    power_r = 1

    for n in range(2,N+1):

        power_r = power_r*n % (10**9+7)

    return power_r

if __name__ == '__main__':

    N = int(input())

    print((factorial(N)))

def factorial(N):
    power_r = 1
    for n in range(2, N + 1):
        power_r *= n
        power_r %= 10**9 + 7
    return power_r

if __name__ == "__main__":
    N = int(input())
    print((factorial(N)))

def factorial(N):
    power_r = 1
    for n in range(2, N + 1):
        power_r = power_r * n % (10**9 + 7)
    return power_r

if __name__ == "__main__":
    N = int(input())
    print((factorial(N)))


Input:
import sys

K = int(input())

power = 7

SUM = 0

for i in range(1, 10 ** 6):

    SUM += power

    if SUM % K == 0:

        print(i)

        sys.exit()

    power *= 10

    power %= K

print((-1))

import sys

K = int(input())

L = 9 * K

if K % 7 == 0:

    L //= 7

power = 1

for i in range(1, 10 ** 6):

    power *= 10

    power %= L

    if power == 1:

        print(i)

        sys.exit()

print((-1))

import sys

K = int(input())
power = 7
SUM = 0
for i in range(1, 10**6):
    SUM += power
    if SUM % K == 0:
        print(i)
        sys.exit()
    power *= 10
    power %= K
print((-1))

import sys

K = int(input())
L = 9 * K
if K % 7 == 0:
    L //= 7
power = 1
for i in range(1, 10**6):
    power *= 10
    power %= L
    if power == 1:
        print(i)
        sys.exit()
print((-1))

-power = 7
-SUM = 0
+L = 9 * K
+if K % 7 == 0:
+    L //= 7
+power = 1
-    SUM += power
-    if SUM % K == 0:
+    power *= 10
+    power %= L
+    if power == 1:
-    power *= 10
-    power %= K


Input:
from functools import reduce

from itertools import product

N = int(input())

*A, = list(map(int, input().split()))

ans = 0

for t in product([-1, 0, 1], repeat=N):

    prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])

    if prod % 2 == 0: ans += 1

print(ans)

N = int(input())

*A, = list(map(int, input().split()))

evens = 0

for a in A:

    if a % 2 == 0: evens += 1

ans = 3**N - 2**evens

print(ans)

from functools import reduce
from itertools import product

N = int(input())
(*A,) = list(map(int, input().split()))
ans = 0
for t in product([-1, 0, 1], repeat=N):
    prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])
    if prod % 2 == 0:
        ans += 1
print(ans)

N = int(input())
(*A,) = list(map(int, input().split()))
evens = 0
for a in A:
    if a % 2 == 0:
        evens += 1
ans = 3**N - 2**evens
print(ans)

-for t in product([-1, 0, 1], repeat=N):

-    prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])


Input:
l, r=list(map(int, input().split()))

if r-l>672:

	p=0

else:

	p=2019

	for i in range(l, r):

		for j in range(i+1, r+1):

			p=min(p, (((i%2019)*(j%2019))%2019))

			if not p:

				break

		if not p:

			break

print(p)

l, r=list(map(int, input().split()))

if r-l>672:

	p=0

else:

	p=2019

	for i in range(l, r):

		for j in range(i+1, r+1):

			p=min(p, (i*j%2019))

			if not p:

				break

		if not p:

			break

print(p)

l, r = list(map(int, input().split()))
if r - l > 672:
    p = 0
else:
    p = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            p = min(p, (((i % 2019) * (j % 2019)) % 2019))
            if not p:
                break
        if not p:
            break
print(p)

l, r = list(map(int, input().split()))
if r - l > 672:
    p = 0
else:
    p = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            p = min(p, (i * j % 2019))
            if not p:
                break
        if not p:
            break
print(p)


Input:
a,b,c,x,y = list(map(int,input().split()))

price = 10**10

for k in range(10**5+1):

    re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b

    price = min(re,price)

print(price)

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

a1 = a*x + b*y

a2 = max(x,y) * 2*c

if y >= x:

    a3 = 2*c*x + (y-x)*b

else:

    a3 = 2*c*y + (x-y)*a

print((min(a1,a2,a3)))

a, b, c, x, y = list(map(int, input().split()))
price = 10**10
for k in range(10**5 + 1):
    re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b
    price = min(re, price)
print(price)

a, b, c, x, y = list(map(int, input().split()))
a1 = a * x + b * y
a2 = max(x, y) * 2 * c
if y >= x:
    a3 = 2 * c * x + (y - x) * b
else:
    a3 = 2 * c * y + (x - y) * a
print((min(a1, a2, a3)))


Input:
import math

print((math.factorial(int(input()))%(10**9+7)))

ans=1

n=int(input())

for i in range(1,n+1):

    ans*=i

    ans=ans%(10**9+7)

print(ans)

import math

print((math.factorial(int(input())) % (10**9 + 7)))

ans = 1
n = int(input())
for i in range(1, n + 1):
    ans *= i
    ans = ans % (10**9 + 7)
print(ans)

-print((math.factorial(int(input())) % (10**9 + 7)))


Input:
import sys

input = sys.stdin.readline

n = int(input())

ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])

cnt = 0

for b, a in ab:

    cnt += a

    if cnt > b:

        print('No')

        break

else:

    print('Yes')

n = int(input())

ab = [list(map(int, input().split())) for _ in range(n)]

ab = sorted(ab, key=lambda x: x[1])

t = 0

for a, b in ab:

    t += a

    if t > b:

        print('No')

        break

else:

    print('Yes')

import sys

input = sys.stdin.readline
n = int(input())
ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])
cnt = 0
for b, a in ab:
    cnt += a
    if cnt > b:
        print("No")
        break
else:
    print("Yes")

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda x: x[1])
t = 0
for a, b in ab:
    t += a
    if t > b:
        print("No")
        break
else:
    print("Yes")

-ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])

+ab = [list(map(int, input().split())) for _ in range(n)]


Input:
k,m=list(map(int,input().split()))

l=[0 for i in range(k+1)]

for i in range(m):

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

  l[a-1]+=1;l[s]-=1

ans=0

f=0

for j in range(k):

  l[j]+=f

  f=l[j]

print((len([1 for i in l if i==m])))

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

table=[0]*(n+2)

for i in range(m):

    l,r=list(map(int,input().split()))

    table[l]+=1

    table[r+1]-=1

from itertools import accumulate

from collections import Counter as co

var=co((accumulate(table)))

if m not in var:print((0))

else:print((var[m]))

k, m = list(map(int, input().split()))
l = [0 for i in range(k + 1)]
for i in range(m):
    a, s = list(map(int, input().split()))
    l[a - 1] += 1
    l[s] -= 1
ans = 0
f = 0
for j in range(k):
    l[j] += f
    f = l[j]
print((len([1 for i in l if i == m])))

n, m = list(map(int, input().split()))
table = [0] * (n + 2)
for i in range(m):
    l, r = list(map(int, input().split()))
    table[l] += 1
    table[r + 1] -= 1
from itertools import accumulate
from collections import Counter as co

var = co((accumulate(table)))
if m not in var:
    print((0))
else:
    print((var[m]))

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

+    l, r = list(map(int, input().split()))


Input:
import math

N = int(input())

ans = 10**12

for i in range(1,10**6+1):

  j = math.ceil(N/(i+1))

  if (1+i)*j == N:

    ans = min(i+j-1,ans)

  if i == 10**6 and ans == 10**12:

    ans = N-1

    break

print(ans)

N = int(input())

ans = 10**12

for i in range(1,10**6+1):

  j = N//i

  if i*j == N:

    ans = min(i+j-2,ans)

  if i == 10**6 and ans == 10**12:

    ans = N-1

    break

print(ans)

import math

N = int(input())
ans = 10**12
for i in range(1, 10**6 + 1):
    j = math.ceil(N / (i + 1))
    if (1 + i) * j == N:
        ans = min(i + j - 1, ans)
    if i == 10**6 and ans == 10**12:
        ans = N - 1
        break
print(ans)

N = int(input())
ans = 10**12
for i in range(1, 10**6 + 1):
    j = N // i
    if i * j == N:
        ans = min(i + j - 2, ans)
    if i == 10**6 and ans == 10**12:
        ans = N - 1
        break
print(ans)

-import math
-    j = math.ceil(N / (i + 1))
-    if (1 + i) * j == N:
-        ans = min(i + j - 1, ans)
+    j = N // i
+    if i * j == N:
+        ans = min(i + j - 2, ans)


Input: print((sum(si != ti for si, ti in zip(input(), input()))))

print((sum(a!=b for a,b in zip(*open(0)))))

-print((sum(si != ti for si, ti in zip(input(), input()))))

+print((sum(a != b for a, b in zip(*open(0)))))


Input:
n = int(input())

x = [int(i) for i in input().split()]

p = 10000000

for i in range(100):

    pi = 0

    for j in range(n):

        pi += (x[j] - (i + 1))**2

    if pi < p:

        p = pi

    # else:

    #     break

        # p[i] += (x[j]-(i+1))**2

print(p)

n = int(input())

x = [int(i) for i in input().split()]

p = 10000000

for i in range(100):

    pi = 0

    for j in range(n):

        pi += (x[j] - (i + 1))**2

    if pi < p:

        p = pi

    else:

        break

        # p[i] += (x[j]-(i+1))**2

print(p)

n = int(input())
x = [int(i) for i in input().split()]
p = 10000000
for i in range(100):
    pi = 0
    for j in range(n):
        pi += (x[j] - (i + 1)) ** 2
    if pi < p:
        p = pi
    # else:
    #     break
    # p[i] += (x[j]-(i+1))**2
print(p)

n = int(input())
x = [int(i) for i in input().split()]
p = 10000000
for i in range(100):
    pi = 0
    for j in range(n):
        pi += (x[j] - (i + 1)) ** 2
    if pi < p:
        p = pi
    else:
        break
        # p[i] += (x[j]-(i+1))**2
print(p)


Input:
# -*- coding: utf-8 -*-

from collections import deque

def inpl(): return list(map(int, input().split()))

S = input()

A = set("ATCG")

ans = 0

mode = 0

for i, s in enumerate(S):

    if s in A:

        if mode == 0:

            mode = 1

            start = i

    else:

        if mode == 1:

            ans = max(i - start, ans)

            mode = 0

if mode == 1:

    ans = max(len(S) - start, ans)

print(ans)

def inpl(): return list(map(int, input().split()))

S = input()

C = set("ACGT")

tmp = 0

ans = 0

for s in S:

    if s in C:

        tmp += 1

    else:

        ans = max(ans, tmp)

        tmp = 0

ans = max(ans, tmp)

print(ans)

-# -*- coding: utf-8 -*-
-from collections import deque
-A = set("ATCG")
+C = set("ACGT")
+tmp = 0
-mode = 0
-for i, s in enumerate(S):
-    if s in A:
-        if mode == 0:
-            mode = 1
-            start = i
+for s in S:
+    if s in C:
+        tmp += 1
-        if mode == 1:
-            ans = max(i - start, ans)
-            mode = 0
-if mode == 1:
-    ans = max(len(S) - start, ans)
+        ans = max(ans, tmp)
+        tmp = 0
+ans = max(ans, tmp)


Input:
N = int(input())

ans = 0

for i in range(1, N + 1):

    if len(str(i)) % 2 == 1:

        ans += 1

print(ans)

N = int(input())

print((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))

+print((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))


Input:
S = input()

k = int(input())

A = set()

for l in range(k+1):

	for i in range(len(S)-l):

			A.add(S[i:i+l+1])

A = sorted(list(A))

print((A[k-1]))

S = input()

l = len(S)

d = set()

K = int(input())

for i in range(5):

    for j in range(l-i):

        d.add(S[j:j+i+1])

D = sorted(list(d))

print((D[K-1]))

S = input()
k = int(input())
A = set()
for l in range(k + 1):
    for i in range(len(S) - l):
        A.add(S[i : i + l + 1])
A = sorted(list(A))
print((A[k - 1]))

S = input()
l = len(S)
d = set()
K = int(input())
for i in range(5):
    for j in range(l - i):
        d.add(S[j : j + i + 1])
D = sorted(list(d))
print((D[K - 1]))

-k = int(input())
-A = set()
-for l in range(k + 1):
-    for i in range(len(S) - l):
-        A.add(S[i : i + l + 1])
-A = sorted(list(A))
-print((A[k - 1]))
+l = len(S)
+d = set()
+K = int(input())
+for i in range(5):
+    for j in range(l - i):
+        d.add(S[j : j + i + 1])
+D = sorted(list(d))
+print((D[K - 1]))


Input:
import sys

input = sys.stdin.readline

from collections import *

K = int(input())

A, B = list(map(int, input().split()))

for i in range(A, B+1):

    if i%K==0:

        print('OK')

        exit()

print('NG')

K = int(input())

A, B = list(map(int, input().split()))

if (A-1)//K!=B//K:

    print('OK')

else:

    print('NG')

import sys

input = sys.stdin.readline
from collections import *

K = int(input())
A, B = list(map(int, input().split()))
for i in range(A, B + 1):
    if i % K == 0:
        print("OK")
        exit()
print("NG")

K = int(input())
A, B = list(map(int, input().split()))
if (A - 1) // K != B // K:
    print("OK")
else:
    print("NG")

-import sys
-input = sys.stdin.readline
-from collections import *
-for i in range(A, B + 1):
-    if i % K == 0:
-        print("OK")
-        exit()
-print("NG")
+if (A - 1) // K != B // K:
+    print("OK")
+else:
+    print("NG")


Input:
from heapq import heappush, heappop

k = int(input())

heap = [(1,1)]

dist = [float("inf")]*k

while heap:

    cost, cur = heappop(heap)

    if dist[cur] <= cost:

        continue

    dist[cur] = cost

    # +1

    nxt = (cur+1)%k

    heappush(heap, (cost+1, nxt))

    # *10

    nxt = cur*10 % k

    heappush(heap, (cost, nxt))

print((dist[0]))

from collections import deque

k = int(input())

que = deque()

que.append((1,1))

dist = [float("inf")]*k

while que:

    cost, cur = que.popleft()

    if dist[cur] <= cost:

        continue

    dist[cur] = cost

    # +1

    nxt = (cur+1)%k

    que.append((cost+1,nxt))

    # *10

    nxt = cur*10 % k

    que.appendleft((cost, nxt))

print((dist[0]))

from heapq import heappush, heappop

k = int(input())
heap = [(1, 1)]
dist = [float("inf")] * k
while heap:
    cost, cur = heappop(heap)
    if dist[cur] <= cost:
        continue
    dist[cur] = cost
    # +1
    nxt = (cur + 1) % k
    heappush(heap, (cost + 1, nxt))
    # *10
    nxt = cur * 10 % k
    heappush(heap, (cost, nxt))
print((dist[0]))

from collections import deque

k = int(input())
que = deque()
que.append((1, 1))
dist = [float("inf")] * k
while que:
    cost, cur = que.popleft()
    if dist[cur] <= cost:
        continue
    dist[cur] = cost
    # +1
    nxt = (cur + 1) % k
    que.append((cost + 1, nxt))
    # *10
    nxt = cur * 10 % k
    que.appendleft((cost, nxt))
print((dist[0]))

-from heapq import heappush, heappop
+from collections import deque
-heap = [(1, 1)]
+que = deque()
+que.append((1, 1))
-while heap:
-    cost, cur = heappop(heap)
+while que:
+    cost, cur = que.popleft()
-    heappush(heap, (cost + 1, nxt))
+    que.append((cost + 1, nxt))
-    heappush(heap, (cost, nxt))
+    que.appendleft((cost, nxt))


Input:
S = input()

T = input()

l = len(S)

res = 0

for n in range(l):

    if S[n] == T[n]:

        res += 1

print(res)

S = input()

T = input()

l = len(S)

ans = 0

for n in range(l):

    if S[n] == T[n]:

        ans += 1

print(ans)

-res = 0
+ans = 0
-        res += 1
-print(res)
+        ans += 1
+print(ans)


Input:
A, B, C, X, Y = list(map(int, input().split()))

max_iter = max(X, Y) * 2

ans = float("inf")

for i in range(max_iter):

    a = max(X - i, 0)

    b = max(Y - i, 0)

    price = 2*C * i + A * a + B * b

    ans = min(ans, price)

print(ans)

A, B, C, X, Y = list(map(int, input().split()))

ans = float("inf")

for i in range(max(X, Y)+1):

    x = max(X - i, 0)

    y = max(Y - i, 0)

    cost = 2*C * i + A * x + B * y

    ans = min(ans, cost)

print(ans)

A, B, C, X, Y = list(map(int, input().split()))
max_iter = max(X, Y) * 2
ans = float("inf")
for i in range(max_iter):
    a = max(X - i, 0)
    b = max(Y - i, 0)
    price = 2 * C * i + A * a + B * b
    ans = min(ans, price)
print(ans)

A, B, C, X, Y = list(map(int, input().split()))
ans = float("inf")
for i in range(max(X, Y) + 1):
    x = max(X - i, 0)
    y = max(Y - i, 0)
    cost = 2 * C * i + A * x + B * y
    ans = min(ans, cost)
print(ans)

-max_iter = max(X, Y) * 2
-for i in range(max_iter):
-    a = max(X - i, 0)
-    b = max(Y - i, 0)
-    price = 2 * C * i + A * a + B * b
-    ans = min(ans, price)
+for i in range(max(X, Y) + 1):
+    x = max(X - i, 0)
+    y = max(Y - i, 0)
+    cost = 2 * C * i + A * x + B * y
+    ans = min(ans, cost)


Input:
a,b,c,x,y = list(map(int,input().split()))

ans = a*x + b*y

for i in range(max(x,y) + 1):

	money = max(0,(x-i)*a) + max(0,(y-i)*b) + 2*i*c

	if money <= ans:

		ans = money

print(ans)

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

if a + b >= 2*c:

	if x >= y:

		ans = 2*y*c + (x-y)*min(a,2*c)

	else:

		ans = 2*x*c + (y-x)*min(b,2*c)

else:

	ans = (x*a + y*b)

print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
for i in range(max(x, y) + 1):
    money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c
    if money <= ans:
        ans = money
print(ans)

a, b, c, x, y = list(map(int, input().split()))
if a + b >= 2 * c:
    if x >= y:
        ans = 2 * y * c + (x - y) * min(a, 2 * c)
    else:
        ans = 2 * x * c + (y - x) * min(b, 2 * c)
else:
    ans = x * a + y * b
print(ans)


Input:
N = int(input())

score = [list(map(int, input().split())) for _ in range(N)]

players = [0 for _ in range(N)]

for play in list(zip(*score)):

    for i, p in enumerate(play):

        if play.count(p) == 1:

            players[i] += p

print(*players, sep='\n')

N = int(input())

score = [input().split() for _ in range(N)]

players = [0]*N

for play in list(zip(*score)):

    for i, p in enumerate(play):

        if play.count(p) == 1:

            players[i] += int(p)

print(*players, sep='\n')

N = int(input())
score = [list(map(int, input().split())) for _ in range(N)]
players = [0 for _ in range(N)]
for play in list(zip(*score)):
    for i, p in enumerate(play):
        if play.count(p) == 1:
            players[i] += p
print(*players, sep="\n")

N = int(input())
score = [input().split() for _ in range(N)]
players = [0] * N
for play in list(zip(*score)):
    for i, p in enumerate(play):
        if play.count(p) == 1:
            players[i] += int(p)
print(*players, sep="\n")

-score = [list(map(int, input().split())) for _ in range(N)]

+score = [input().split() for _ in range(N)]


Input:
n,k = list(map(int,input().split()))

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

dp = [False]*(k+1)

for stones in range(k+1):

    for x in arr:

        if stones >= x and dp[stones-x] == False:

            dp[stones] = True

if dp[k]:

    print("First")

else:

    print("Second")

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

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

dp = [False]*(K+1)

for i in range(K+1):

    for j in range(N):

        if i-A[j]>=0 and dp[i-A[j]] == False:

            dp[i] = True

if dp[K]:

    print("First")

else:

    print("Second")

n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
dp = [False] * (k + 1)
for stones in range(k + 1):
    for x in arr:
        if stones >= x and dp[stones - x] == False:
            dp[stones] = True
if dp[k]:
    print("First")
else:
    print("Second")

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [False] * (K + 1)
for i in range(K + 1):
    for j in range(N):
        if i - A[j] >= 0 and dp[i - A[j]] == False:
            dp[i] = True
if dp[K]:
    print("First")
else:
    print("Second")

-        if stones >= x and dp[stones - x] == False:

+        if i - A[j] >= 0 and dp[i - A[j]] == False:


Input:
W = input().lower()

s = []

while True:

    T = list(map(str, input().split()))

    if(T[0] == "END_OF_TEXT"):

        break

    else:

        for i in range(len(T)):

            s.append(T[i].lower())

ans = 0

for i in range(len(s)):

    if(s[i] == W):

        ans += 1

print(ans)

W = input().lower()

s = []

ans = 0

while True:

    T = list(map(str, input().split()))

    if(T[0] == "END_OF_TEXT"):

        break

    else:

        for i in range(len(T)):

            if(W == T[i].lower()):

                ans += 1

print(ans)

W = input().lower()
s = []
while True:
    T = list(map(str, input().split()))
    if T[0] == "END_OF_TEXT":
        break
    else:
        for i in range(len(T)):
            s.append(T[i].lower())
ans = 0
for i in range(len(s)):
    if s[i] == W:
        ans += 1
print(ans)

W = input().lower()
s = []
ans = 0
while True:
    T = list(map(str, input().split()))
    if T[0] == "END_OF_TEXT":
        break
    else:
        for i in range(len(T)):
            if W == T[i].lower():
                ans += 1
print(ans)

+ans = 0
-            s.append(T[i].lower())
-ans = 0
-for i in range(len(s)):
-    if s[i] == W:
-        ans += 1
+            if W == T[i].lower():
+                ans += 1


Input:
import math

print((math.factorial(int(input()))%(10**9+7)))

n=int(input())

ans=1

for i in range(1,n+1):

    ans*=i

    ans%=10**9+7

print(ans)

import math

print((math.factorial(int(input())) % (10**9 + 7)))

n = int(input())
ans = 1
for i in range(1, n + 1):
    ans *= i
    ans %= 10**9 + 7
print(ans)

-print((math.factorial(int(input())) % (10**9 + 7)))


Input:
import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

N = int(readline())

S = read().split()

S = sorted(S)

ls = [[] for i in range(N + 1)]

max_num = 0

left = 0

right = 0

while right < N:

    while right < N and S[left] == S[right]:

        right += 1

    if (right  - left) >= max_num:

        ls[right - left].append(S[left].decode())

        max_num = right - left

    left = right

print(('\n'.join(ls[max_num])))

from collections import Counter

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

N = int(readline())

S = read().split()

res = []

c = Counter(S)

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

for i, j in list(c.items()):

    if j == max_num:

        res.append(i)

res.sort()

print(('\n'.join(list([x.decode() for x in res]))))

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = read().split()
S = sorted(S)
ls = [[] for i in range(N + 1)]
max_num = 0
left = 0
right = 0
while right < N:
    while right < N and S[left] == S[right]:
        right += 1
    if (right - left) >= max_num:
        ls[right - left].append(S[left].decode())
        max_num = right - left
    left = right
print(("\n".join(ls[max_num])))

from collections import Counter
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = read().split()
res = []
c = Counter(S)
max_num = c.most_common(1)[0][1]
for i, j in list(c.items()):
    if j == max_num:
        res.append(i)
res.sort()
print(("\n".join(list([x.decode() for x in res]))))

-    while right < N and S[left] == S[right]:

-        ls[right - left].append(S[left].decode())

+print(("\n".join(list([x.decode() for x in res]))))


Input:
def main():

  n = int(input())

  dp = [0]*(n+1)

  dp[0] = 1

  mod = pow(10, 9) + 7

  for i in range(n+1):

    for j in range(i-2):

      dp[i] += dp[j]

      dp[i] %= mod

  print((dp[n]))

if __name__ == "__main__":

  main()

def main():

  n = int(input())

  dp = [0]*(n+1)

  dp[0] = 1

  mod = pow(10, 9) + 7

  for i in range(3, n+1):

    dp[i] = dp[i-1] + dp[i-3]

    dp[i] %= mod

  print((dp[n]))

if __name__ == "__main__":

  main()

def main():
    n = int(input())
    dp = [0] * (n + 1)
    dp[0] = 1
    mod = pow(10, 9) + 7
    for i in range(n + 1):
        for j in range(i - 2):
            dp[i] += dp[j]
            dp[i] %= mod
    print((dp[n]))

if __name__ == "__main__":
    main()

def main():
    n = int(input())
    dp = [0] * (n + 1)
    dp[0] = 1
    mod = pow(10, 9) + 7
    for i in range(3, n + 1):
        dp[i] = dp[i - 1] + dp[i - 3]
        dp[i] %= mod
    print((dp[n]))

if __name__ == "__main__":
    main()

-    for i in range(n + 1):
-        for j in range(i - 2):
-            dp[i] += dp[j]
-            dp[i] %= mod
+    for i in range(3, n + 1):
+        dp[i] = dp[i - 1] + dp[i - 3]
+        dp[i] %= mod


Input:
l,r = list(map(int,input().split()))

if r - l > 2019:

    print((0))

else:

    tres = 2019

    for i in range(l,r):

        for j in range(i+1,r+1):

            mod = (i % 2019) * (j % 2019) % 2019

            tres = min(tres,mod)

    print(tres)

l,r = list(map(int,input().split()))

if r - l > 2019:

    print((0))

else:

    tres = 2019

    for i in range(l,r):

        for j in range(i+1,r+1):

            mod = (i % 2019) * (j % 2019) % 2019

            tres = min(tres,mod)

            if tres == 0:

                break

        if tres == 0:

            break

    print(tres)

l, r = list(map(int, input().split()))
if r - l > 2019:
    print((0))
else:
    tres = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            mod = (i % 2019) * (j % 2019) % 2019
            tres = min(tres, mod)
    print(tres)

l, r = list(map(int, input().split()))
if r - l > 2019:
    print((0))
else:
    tres = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            mod = (i % 2019) * (j % 2019) % 2019
            tres = min(tres, mod)
            if tres == 0:
                break
        if tres == 0:
            break
    print(tres)

+            if tres == 0:
+                break
+        if tres == 0:
+            break


Input:
#                         author:  kagemeka

#                         created: 2019-11-08 14:51:29(JST)

## internal modules

import sys

# import collections

# import math

# import string

# import bisect

# import re

# import itertools

import statistics

# import functools

# import operator

## external modules

# import scipy.special   # if use comb function on AtCoder,

# import scipy.misc      # select scipy.misc.comb (old version)

def main():

    n, *a = (int(x) for x in sys.stdin.read().split())

    for i in range(n):

        a[i] -= (i + 1)

    if n % 2 != 0:

        b = statistics.median(a)

    else:

        if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):

            b = statistics.median_high(a)

        else:

            b = statistics.median_low(a)

    ans = sum([abs(a[i] - b) for i in range(n)])

    print(ans)

if __name__ == "__main__":

    # execute only if run as a script

    main()

import sys

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

def main():

    for i in range(n):

        a[i] -= (i + 1)

    a.sort()

    b = a[n // 2]

    res = 0

    for i in range(n):

        res += abs(a[i] - b)

    return res

if __name__ == '__main__':

    ans = main()

    print(ans)

#                         author:  kagemeka
#                         created: 2019-11-08 14:51:29(JST)
## internal modules
import sys

# import collections
# import math
# import string
# import bisect
# import re
# import itertools
import statistics

# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder,
# import scipy.misc      # select scipy.misc.comb (old version)
def main():
    n, *a = (int(x) for x in sys.stdin.read().split())
    for i in range(n):
        a[i] -= i + 1
    if n % 2 != 0:
        b = statistics.median(a)
    else:
        if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):
            b = statistics.median_high(a)
        else:
            b = statistics.median_low(a)
    ans = sum([abs(a[i] - b) for i in range(n)])
    print(ans)

if __name__ == "__main__":
    # execute only if run as a script
    main()

import sys

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

def main():
    for i in range(n):
        a[i] -= i + 1
    a.sort()
    b = a[n // 2]
    res = 0
    for i in range(n):
        res += abs(a[i] - b)
    return res

if __name__ == "__main__":
    ans = main()
    print(ans)

-#                         author:  kagemeka

+n, *a = list(map(int, sys.stdin.read().split()))

-# import scipy.special   # if use comb function on AtCoder,

-# import scipy.misc      # select scipy.misc.comb (old version)

-    n, *a = (int(x) for x in sys.stdin.read().split())

-        if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):

-            b = statistics.median_high(a)

-            b = statistics.median_low(a)

-    ans = sum([abs(a[i] - b) for i in range(n)])


Input:
def findSumDigit(num):

    global total

    total = ""

    while num > 0:

        total += str(num % 10)

        num //= 10

    return total

def main():

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

    ans = 0

    for i in range(a,b+1):

        tmp = str(findSumDigit(i))

        if tmp == str(i):

            ans += 1

    print(ans)

if __name__ == '__main__':

    main()

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

ans = 0

for i in range(a,b+1):

    seki_gyaku = str(i)

    if seki_gyaku == seki_gyaku[::-1]:

        ans += 1

print(ans)

def findSumDigit(num):
    global total
    total = ""
    while num > 0:
        total += str(num % 10)
        num //= 10
    return total

def main():
    a, b = list(map(int, input().split()))
    ans = 0
    for i in range(a, b + 1):
        tmp = str(findSumDigit(i))
        if tmp == str(i):
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
    seki_gyaku = str(i)
    if seki_gyaku == seki_gyaku[::-1]:
        ans += 1
print(ans)

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


Input:
N = int(input())

a = [int(input()) for i in range(N)]

now = a[0]

count = 1

c = 0

for i in range(10**6):

    if now != 2:

        count += 1

        now = a[now - 1]

    else:

        print(count)

        c = 1

        break

if c == 0:

    print((-1))

N = int(input())

a = [0] + [int(input()) for _ in range(N)]

x = 1

visited = set([1])

answer = 0

while True:

  x = a[x]

  if x in visited:

    answer = -1

    break

  visited.add(x)

  answer += 1

  if x == 2:

    break

print(answer)

+a = [0] + [int(input()) for _ in range(N)]


Input:
N = int(input())

ans = 0

for i in range(1, N+1):

    if len(str(i))%2==1:

        ans += 1

print(ans)

import sys

def rec(length):

    if length == 1:

        return 9

    else:

        return 9 * 10**(length - 1) + rec(length - 2)

n = input()

length = len(n)

if length == 1:

    print(n)

    sys.exit()

if length % 2 == 0:

    ans = rec(length - 1)

else:

    ans = rec(length - 2) + int(n) - int("1" + "0" * (length - 1)) + 1

print(ans)

N = int(input())
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

import sys

def rec(length):
    if length == 1:
        return 9
    else:
        return 9 * 10 ** (length - 1) + rec(length - 2)

n = input()
length = len(n)
if length == 1:
    print(n)
    sys.exit()
if length % 2 == 0:
    ans = rec(length - 1)
else:
    ans = rec(length - 2) + int(n) - int("1" + "0" * (length - 1)) + 1
print(ans)

+        return 9 * 10 ** (length - 1) + rec(length - 2)


Input:
import itertools

from collections import Counter

N = int(input())

src = [input() for i in range(N)]

ctr = Counter()

for s in src:

    ctr[s[0]] += 1

ans = 0

for ptn in itertools.combinations('MARCH',3):

    a,b,c = ptn

    ans += ctr[a]*ctr[b]*ctr[c]

print(ans)

N = int(input())

S = [input() for i in range(N)]

from collections import Counter

ctr = Counter([s[0] for s in S])

ans = 0

import itertools

for ptn in itertools.combinations('MARCH', 3):

    t = 1

    for c in ptn:

        t *= ctr[c]

    ans += t

print(ans)

import itertools
from collections import Counter

N = int(input())
src = [input() for i in range(N)]
ctr = Counter()
for s in src:
    ctr[s[0]] += 1
ans = 0
for ptn in itertools.combinations("MARCH", 3):
    a, b, c = ptn
    ans += ctr[a] * ctr[b] * ctr[c]
print(ans)

N = int(input())
S = [input() for i in range(N)]
from collections import Counter

ctr = Counter([s[0] for s in S])
ans = 0
import itertools

for ptn in itertools.combinations("MARCH", 3):
    t = 1
    for c in ptn:
        t *= ctr[c]
    ans += t
print(ans)

-import itertools
+N = int(input())
+S = [input() for i in range(N)]
-N = int(input())
-src = [input() for i in range(N)]
-ctr = Counter()
-for s in src:
-    ctr[s[0]] += 1
+ctr = Counter([s[0] for s in S])
+import itertools
+
-    a, b, c = ptn
-    ans += ctr[a] * ctr[b] * ctr[c]
+    t = 1
+    for c in ptn:
+        t *= ctr[c]
+    ans += t


Input:
N = int(input())

count = 0

for i in range(1, N + 1):

    num_dig = 0

    ii = i

    while ii > 0:

        ii = int(ii / 10)

        num_dig += 1

    if num_dig % 2 != 0:

        count += 1

print(count)

N = int(input())

count = 0

for i in range(1, N + 1):

    if len(str(i)) % 2 != 0:

        count += 1

print(count)

-    num_dig = 0
-    ii = i
-    while ii > 0:
-        ii = int(ii / 10)
-        num_dig += 1
-    if num_dig % 2 != 0:
+    if len(str(i)) % 2 != 0:


Input:
from string import ascii_lowercase as lower

print((lower[lower.find(input())+1]))

from string import ascii_lowercase as lower

print((lower[lower.find(input()) + 1]))

-from string import ascii_lowercase as lower


Input:
import string

w = input()

for a in string.ascii_lowercase:

    cnt = 0

    for t in w:

        if t == a:

            cnt = cnt + 1

    if cnt % 2 == 1:

        print("No")

        exit()

print("Yes")

w = input()

m = [0] * 26

for t in w:

    m[ord(t) - ord('a')] += 1

for cnt in m:

    if cnt % 2 == 1:

        print("No")

        exit()

print("Yes")

w = input()
m = [0] * 26
for t in w:
    m[ord(t) - ord("a")] += 1
for cnt in m:
    if cnt % 2 == 1:
        print("No")
        exit()
print("Yes")

-import string
-for a in string.ascii_lowercase:
-    cnt = 0
-    for t in w:
-        if t == a:
-            cnt = cnt + 1
+m = [0] * 26
+for t in w:
+    m[ord(t) - ord("a")] += 1
+for cnt in m:


Input:
mod = 10**9+7

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

l = [0]*n

for _ in range(m):

  l[int(input())-1] = 1

s = 0

t = 1

for i in range(n):

  if l[i] > 0:

    t, s = 0, t

  else:

    t, s = (s+t)%mod, t

print(t)

import sys

input = sys.stdin.readline

mod = 10**9+7

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

l = [0]*n

for _ in range(m):

  l[int(input())-1] = 1

t, s = 1, 0

for i in range(n):

  if l[i]:

    t, s = 0, t

  else:

    t, s = (s+t)%mod, t

print(t)

mod = 10**9 + 7
n, m = list(map(int, input().split()))
l = [0] * n
for _ in range(m):
    l[int(input()) - 1] = 1
s = 0
t = 1
for i in range(n):
    if l[i] > 0:
        t, s = 0, t
    else:
        t, s = (s + t) % mod, t
print(t)

import sys

input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().split()))
l = [0] * n
for _ in range(m):
    l[int(input()) - 1] = 1
t, s = 1, 0
for i in range(n):
    if l[i]:
        t, s = 0, t
    else:
        t, s = (s + t) % mod, t
print(t)

+import sys
+
+input = sys.stdin.readline
-s = 0
-t = 1
+t, s = 1, 0
-    if l[i] > 0:
+    if l[i]:


Input:
N,M = [int(c) for c in input().split()]

ab = [list(map(int,input().split())) for c in range(N)]

cd = [list(map(int,input().split())) for c in range(M)]

for i in range(N):

    mi = 2*10**9

    for j in range(M):

        tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])

        if mi > tmp:

            mi = tmp

            ans = j+1

    print(ans)

N,M = [int(c) for c in input().split()]

ab = [list(map(int,input().split())) for c in range(N)]

cd = [list(map(int,input().split())) for c in range(M)]

for i in range(N):

    mi = 10**9

    for j in range(M):

        tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])

        if mi > tmp:

            mi = tmp

            ans = j+1

    print(ans)

N, M = [int(c) for c in input().split()]
ab = [list(map(int, input().split())) for c in range(N)]
cd = [list(map(int, input().split())) for c in range(M)]
for i in range(N):
    mi = 2 * 10**9
    for j in range(M):
        tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if mi > tmp:
            mi = tmp
            ans = j + 1
    print(ans)

N, M = [int(c) for c in input().split()]
ab = [list(map(int, input().split())) for c in range(N)]
cd = [list(map(int, input().split())) for c in range(M)]
for i in range(N):
    mi = 10**9
    for j in range(M):
        tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if mi > tmp:
            mi = tmp
            ans = j + 1
    print(ans)


Input:
def test():

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

    count = 0

    for i in range(a,b+1):

        j = list(map(int,list(str(i))))

        if j[0] == j[4] and j[1] == j[3]:

            count += 1

    print(count)

if __name__ == "__main__":

    test()

def test():

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

    count = 0

    for i in range(a,b+1):

        if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:

            count += 1

    print(count)

if __name__ == "__main__":

    test()

def test():
    a, b = list(map(int, input().split()))
    count = 0
    for i in range(a, b + 1):
        j = list(map(int, list(str(i))))
        if j[0] == j[4] and j[1] == j[3]:
            count += 1
    print(count)

if __name__ == "__main__":
    test()

def test():
    a, b = list(map(int, input().split()))
    count = 0
    for i in range(a, b + 1):
        if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:
            count += 1
    print(count)

if __name__ == "__main__":
    test()

-        j = list(map(int, list(str(i))))


Input:
X, Y, Z = list(map(int, input().split()))

for n in range(10 ** 5, 0, -1):

    if X >= n * (Y + Z) + Z:

        break

print(n)

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

print(((X - Z) // (Y + Z)))

X, Y, Z = list(map(int, input().split()))
for n in range(10**5, 0, -1):
    if X >= n * (Y + Z) + Z:
        break
print(n)


Input:
array = list(map(int, input().split()))

if array[0] % array[1] > 0:

    print(((array[0] // array[1] + 1) * array[2]))

else:

    print(((array[0] // array[1]) * array[2]))

n, x, t = list(map(int, input().split()))

print((0--n//x*t))

n, x, t = list(map(int, input().split()))
print((0 - -n // x * t))

-array = list(map(int, input().split()))

-    print(((array[0] // array[1]) * array[2]))

+n, x, t = list(map(int, input().split()))


Input:
n=input()

n=int(n)

a=1

for i in range(n):

    a=a*(i+1)

    if a>=pow(10,9)+7:

        a=a%(pow(10,9)+7)

print(a)

n=int(input())

a=1

for i in range(1,n+1):

    a*=i

    a %= (10**9+7)

print(a)

n = input()
n = int(n)
a = 1
for i in range(n):
    a = a * (i + 1)
    if a >= pow(10, 9) + 7:
        a = a % (pow(10, 9) + 7)
print(a)

n = int(input())
a = 1
for i in range(1, n + 1):
    a *= i
    a %= 10**9 + 7
print(a)


Input:
import sys

r = []

n = int(input())

l = sys.stdin.readlines()

for i in l:

  x, y, z = sorted([x*x for x in list(map(int, i.split()))])

  if x + y == z:

      print("YES")

  else:

      print("NO")

import sys

n = int(input())

l = sys.stdin.readlines()

s = ""

for i in l:

  x, y, z = sorted(map(lambda x:x*x,map(int, i.split())))

  if x + y == z:

      s += "YES\n"

  else:

      s += "NO\n"

print(s,end="")

import sys

r = []
n = int(input())
l = sys.stdin.readlines()
for i in l:
    x, y, z = sorted([x * x for x in list(map(int, i.split()))])
    if x + y == z:
        print("YES")
    else:
        print("NO")

import sys

n = int(input())
l = sys.stdin.readlines()
s = ""
for i in l:
    x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))
    if x + y == z:
        s += "YES\n"
    else:
        s += "NO\n"
print(s, end="")

-    x, y, z = sorted([x * x for x in list(map(int, i.split()))])

+    x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))


Input:
a,b,c,x,y=list(map(int,input().split()))

ans=a*x+b*y

for ci in range(max(x,y)+1):

    sumc = 2*ci*c

    sumc += (x-ci)*a if (x-ci)>0 else 0

    sumc += (y-ci)*b if (y-ci)>0 else 0

    ans=min(ans,sumc)

print(ans)

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

ans=a*x+b*y

if x==y:

    ans=min(ans,2*x*c)

elif x>y:

    ans=min(ans,a*(x-y)+2*y*c)

    ans=min(ans,2*x*c)

else:

    ans=min(ans,b*(y-x)+2*x*c)

    ans=min(ans,2*y*c)

print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
for ci in range(max(x, y) + 1):
    sumc = 2 * ci * c
    sumc += (x - ci) * a if (x - ci) > 0 else 0
    sumc += (y - ci) * b if (y - ci) > 0 else 0
    ans = min(ans, sumc)
print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
if x == y:
    ans = min(ans, 2 * x * c)
elif x > y:
    ans = min(ans, a * (x - y) + 2 * y * c)
    ans = min(ans, 2 * x * c)
else:
    ans = min(ans, b * (y - x) + 2 * x * c)
    ans = min(ans, 2 * y * c)
print(ans)

-    sumc += (x - ci) * a if (x - ci) > 0 else 0

-    sumc += (y - ci) * b if (y - ci) > 0 else 0

+    ans = min(ans, a * (x - y) + 2 * y * c)

+    ans = min(ans, b * (y - x) + 2 * x * c)


Input:
N = int(input())

L = [ 0 ] * 1000000

L[0] = 2

L[1] = 1

for i in range(2, N+1):

  L[i] = L[i-2] + L[i-1]

print((L[N]))


Input:
import sys

N,M=list(map(int,input().split()))

S=set(map(int,sys.stdin))

a,b=0,1

for i in range(1,N+1):

    if i in S:

        a,b=b,0

    else:

        a,b=b,a+b

print((b%(10**9+7)))

import sys

N,M=list(map(int,input().split()))

bad=set(map(int,sys.stdin))

MOD=10**9+7

a,b=0,1

for i in range(1,N+1):

    if i in bad:

        a,b=b,0

        if a==0:

            break

    else:

        a,b=b,(a+b)%MOD

print(b)

import sys

N, M = list(map(int, input().split()))
S = set(map(int, sys.stdin))
a, b = 0, 1
for i in range(1, N + 1):
    if i in S:
        a, b = b, 0
    else:
        a, b = b, a + b
print((b % (10**9 + 7)))

import sys

N, M = list(map(int, input().split()))
bad = set(map(int, sys.stdin))
MOD = 10**9 + 7
a, b = 0, 1
for i in range(1, N + 1):
    if i in bad:
        a, b = b, 0
        if a == 0:
            break
    else:
        a, b = b, (a + b) % MOD
print(b)

-S = set(map(int, sys.stdin))
+bad = set(map(int, sys.stdin))
+MOD = 10**9 + 7
-    if i in S:
+    if i in bad:
+        if a == 0:
+            break
-        a, b = b, a + b
-print((b % (10**9 + 7)))
+        a, b = b, (a + b) % MOD
+print(b)


Input:
import re

while True:

    n = int(input())

    if n == 0:

        break

    l = [0] * (24*60*60+1)

    for _ in range(n):

        h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))

        l[h1*60*60 + m1*60 + s1] += 1

        l[h2*60*60 + m2*60 + s2] -= 1

    r = 0

    for i in range(24*60*60):

        l[i+1] += l[i]

        r = max(r, l[i+1])

    print(r)

while True:

    n = int(input())

    if n == 0:

        break

    l = []

    for _ in range(n):

        hms1, hms2 = input().split()

        l.append((hms1, True))

        l.append((hms2, False))

    l.sort()

    r, t = 0, 0

    for i in range(len(l)):

        if l[i][1]:

            t += 1

        else:

            t -= 1

        r = max(r, t)

    print(r)

-        h1, m1, s1, h2, m2, s2 = list(map(int, re.split(":| ", input())))


Input:
n=int(input())

s=list(map(str,input().split()))

total=[]

for i in range(n):

    if s[i] not in total:

        total.append(s[i])

print(('Three' if len(total)==3 else 'Four'))

input()

l=list(map(str,input().split()))

print(('Three' if len(set(l))==3 else 'Four'))

n = int(input())
s = list(map(str, input().split()))
total = []
for i in range(n):
    if s[i] not in total:
        total.append(s[i])
print(("Three" if len(total) == 3 else "Four"))

input()
l = list(map(str, input().split()))
print(("Three" if len(set(l)) == 3 else "Four"))

-print(("Three" if len(total) == 3 else "Four"))

+print(("Three" if len(set(l)) == 3 else "Four"))


Input:
from math import factorial

N = int(input())

print((factorial(N) % (10**9 + 7)))

from math import factorial

N = int(input())

ans = 1

for i in range(1,N+1):

    ans *= i % (10**9 + 7)

    ans %= 10**9 + 7

print(ans)

from math import factorial

N = int(input())
ans = 1
for i in range(1, N + 1):
    ans *= i % (10**9 + 7)
    ans %= 10**9 + 7
print(ans)


Input:
import math

while True:

	try:

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

		print('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))

	except EOFError:

		break

def gcd(x, y):

    if y == 0:

        return x

    else:

        return gcd(y, x%y)

def lcm(x,y):

    return x/gcd(x, y)*y

while True:

    try:

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

    except EOFError:

        break

    print("%d %d" % (gcd(x, y), lcm(x, y)))

import math

while True:
    try:
        x, y = list(map(int, input().split()))
        print("%d %d" % (math.gcd(x, y), x / math.gcd(x, y) * y))
    except EOFError:
        break

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

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

while True:
    try:
        x, y = list(map(int, input().split()))
    except EOFError:
        break
    print("%d %d" % (gcd(x, y), lcm(x, y)))

-        print("%d %d" % (math.gcd(x, y), x / math.gcd(x, y) * y))

+    print("%d %d" % (gcd(x, y), lcm(x, y)))


Input:
n = int(input())

r = int(n**.5)

for i in range(r):

  if n % (r-i) == 0:

    print(( (r-i) + n//(r-i) - 2 ))

    break

n = int(input())

s = int(n**.5)

for i in range(s):

  if n % (s-i) == 0:

    print(((s-i) + n // (s-i) - 2))

    break

n = int(input())
r = int(n**0.5)
for i in range(r):
    if n % (r - i) == 0:
        print(((r - i) + n // (r - i) - 2))
        break

n = int(input())
s = int(n**0.5)
for i in range(s):
    if n % (s - i) == 0:
        print(((s - i) + n // (s - i) - 2))
        break


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

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

diff = A[0] + K - A[-1]

ans = A[-1] - A[0]

for i in range(1, N):

    dist = K - A[i] + A[i - 1]

    if dist < ans:

        ans = dist

print(ans)

import sys

def input():

    return sys.stdin.readline().strip()

def main():

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

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

    ans = [K - A[i] + A[i - 1] for i in range(1, N)]

    print((min(min(ans), A[-1] - A[0])))

main()

+    return sys.stdin.readline().strip()

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

+    A = list(map(int, input().split()))

+    ans = [K - A[i] + A[i - 1] for i in range(1, N)]


Input:
import sys

input = lambda: sys.stdin.readline().rstrip()

def resolve():

    A, B, C, X, Y = list(map(int, input().split()))

    ans = float('inf')

    for i in range(0, max(X, Y)*2+1, 2):

        ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)

    print(ans)

if __name__ == '__main__':

    resolve()

import sys

input = lambda: sys.stdin.readline().rstrip()

def resolve():

    A, B, C, X, Y = list(map(int, input().split()))

    ans = 0

    if A+B > 2*C:

        ans = 2*C*min(X, Y)+min((A if X>Y else B)*abs(X-Y), 2*C*abs(X-Y))

    else:

        ans = A*X+B*Y

    print(ans)

if __name__ == '__main__':

    resolve()

import sys

input = lambda: sys.stdin.readline().rstrip()

def resolve():
    A, B, C, X, Y = list(map(int, input().split()))
    ans = float("inf")
    for i in range(0, max(X, Y) * 2 + 1, 2):
        ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)
    print(ans)

if __name__ == "__main__":
    resolve()

import sys

input = lambda: sys.stdin.readline().rstrip()

def resolve():
    A, B, C, X, Y = list(map(int, input().split()))
    ans = 0
    if A + B > 2 * C:
        ans = 2 * C * min(X, Y) + min(
            (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)
        )
    else:
        ans = A * X + B * Y
    print(ans)

if __name__ == "__main__":
    resolve()

-    for i in range(0, max(X, Y) * 2 + 1, 2):

+            (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)


Input:
A,B = list(map(int,input().split()))

ans = 0

for i in range(A,B+1):

    i = str(i)

    if i[0] == i[4]:

        if i[1] == i[3]:

            ans += 1

        else:

            ans += 0

    else:

        ans += 0

print(ans)

A,B = list(map(int,input().split()))

ans = 0

for i in range(A,B+1):

    k = str(i)

    if k[0] == k[4] and k[1] == k[3]:

        ans += 1

print(ans)

A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
    i = str(i)
    if i[0] == i[4]:
        if i[1] == i[3]:
            ans += 1
        else:
            ans += 0
    else:
        ans += 0
print(ans)

A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
    k = str(i)
    if k[0] == k[4] and k[1] == k[3]:
        ans += 1
print(ans)


Input:
def main():

    N = int(input())

    A = [int(i) for i in input().split()]

    if N == 1:

        return print(1 if A[0] % 2 == 0 else 2)

    ans = 0

    d = (-1, 0, 1)

    from itertools import product

    for i in product(range(3), repeat=N):

        cur = 1

        for j in range(N):

            cur *= (A[j] + d[i[j]])

        if cur % 2 == 0:

            ans += 1

    print(ans)

if __name__ == '__main__':

    main()

def main():

    N = int(input())

    A = [int(i) for i in input().split()]

    ans = 3**N

    cnt = len([a for a in A if a % 2 == 0])

    ans -= 2**cnt

    print(ans)

if __name__ == '__main__':

    main()

def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    if N == 1:
        return print(1 if A[0] % 2 == 0 else 2)
    ans = 0
    d = (-1, 0, 1)
    from itertools import product

    for i in product(range(3), repeat=N):
        cur = 1
        for j in range(N):
            cur *= A[j] + d[i[j]]
        if cur % 2 == 0:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 3**N
    cnt = len([a for a in A if a % 2 == 0])
    ans -= 2**cnt
    print(ans)

if __name__ == "__main__":
    main()

-        return print(1 if A[0] % 2 == 0 else 2)

-    for i in product(range(3), repeat=N):

+    cnt = len([a for a in A if a % 2 == 0])


Input:
# -*- coding: utf-8 -*-

from collections import defaultdict

from itertools import combinations

N = int(input())

C = [0, 0, 0, 0, 0, 0]

D = defaultdict(int)

for i, m in enumerate("MARCH", start=1):

    D[m] = i

for _ in range(N):

    C[D[input()[0]]] += 1

ans = 0

for a, b, c in combinations(list(range(1, 6)), r=3):

    ans += C[a]*C[b]*C[c]

print(ans)

from collections import defaultdict

from itertools import combinations

def inpl(): return list(map(int, input().split()))

C = defaultdict(int)

N = int(input())

for _ in range(N):

    C[input()[0]] += 1

res = 0

for H in combinations("MARCH", r=3):

    res += C[H[0]] * C[H[1]] * C[H[2]]

print(res)

# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import combinations

N = int(input())
C = [0, 0, 0, 0, 0, 0]
D = defaultdict(int)
for i, m in enumerate("MARCH", start=1):
    D[m] = i
for _ in range(N):
    C[D[input()[0]]] += 1
ans = 0
for a, b, c in combinations(list(range(1, 6)), r=3):
    ans += C[a] * C[b] * C[c]
print(ans)

+    return list(map(int, input().split()))

-for i, m in enumerate("MARCH", start=1):

-for a, b, c in combinations(list(range(1, 6)), r=3):


Input:
import math

N = int(input())

print((math.factorial(N) % (1000000000 + 7)))

import math

N = int(input())

p = 1

for i in range(2, N+1):

  p *= i

  p = p % (1000000000 + 7)

print(p)

import math

N = int(input())
p = 1
for i in range(2, N + 1):
    p *= i
    p = p % (1000000000 + 7)
print(p)


Input:
def main():

    from statistics import median

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

    a = [x - i for i, x in enumerate(a, 1)]

    a.sort()

    m = int(median(a))

    ans = sum([abs(x - m) for x in a])

    print(ans)

if __name__ == '__main__':

    main()

def main():

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

    a = [x - i for i, x in enumerate(a, 1)]

    a.sort()

    if n % 2 == 0:

        ans = sum(a[n // 2:]) - sum(a[:n // 2])

    else:

        ans = sum(a[n // 2 + 1:]) - sum(a[:n // 2])

    print(ans)

if __name__ == '__main__':

    main()

def main():
    from statistics import median

    (
        n,
        *a,
    ) = list(map(int, open(0).read().split()))
    a = [x - i for i, x in enumerate(a, 1)]
    a.sort()
    m = int(median(a))
    ans = sum([abs(x - m) for x in a])
    print(ans)

if __name__ == "__main__":
    main()

def main():
    (
        n,
        *a,
    ) = list(map(int, open(0).read().split()))
    a = [x - i for i, x in enumerate(a, 1)]
    a.sort()
    if n % 2 == 0:
        ans = sum(a[n // 2 :]) - sum(a[: n // 2])
    else:
        ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])
    print(ans)

if __name__ == "__main__":
    main()


Input:
N, M = list(map(int, input().split()))

L, R = [], []

low = -float('INF')

high = float('INF')

for i in range(M):

    l, r = list(map(int, input().split()))

    L.append(l)

    R.append(r)

    if l > low:

        low = l

    if r < high:

        high = r

print((max(0, high - low + 1)))

N, M = list(map(int, input().split()))

low = -float('INF')

high = float('INF')

for i in range(M):

    l, r = list(map(int, input().split()))

    if l > low:

        low = l

    if r < high:

        high = r

print((max(0, high - low + 1)))

N, M = list(map(int, input().split()))
L, R = [], []
low = -float("INF")
high = float("INF")
for i in range(M):
    l, r = list(map(int, input().split()))
    L.append(l)
    R.append(r)
    if l > low:
        low = l
    if r < high:
        high = r
print((max(0, high - low + 1)))

N, M = list(map(int, input().split()))
low = -float("INF")
high = float("INF")
for i in range(M):
    l, r = list(map(int, input().split()))
    if l > low:
        low = l
    if r < high:
        high = r
print((max(0, high - low + 1)))

-L, R = [], []
-    L.append(l)
-    R.append(r)


Input:
a,b,c=1,0,0

exec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))

print(c)


Input:
a, b, c, x, y = list(map(int, input().split()))

z = max(x,y) * 2

min_sum = c * z

for i in range(z):

    r = max(0, y - i) * b

    t = max(0, x - i) * a

    sum = c * i * 2 + r + t

    if sum < min_sum:

        min_sum = sum

print(min_sum)

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

plan_a = c * (2*x) + max(0, y-x) * b

plan_b = c * (2*y) + max(0, x-y) * a

plan_c = a * x + b * y

print((min(plan_a, plan_b, plan_c)))

a, b, c, x, y = list(map(int, input().split()))
z = max(x, y) * 2
min_sum = c * z
for i in range(z):
    r = max(0, y - i) * b
    t = max(0, x - i) * a
    sum = c * i * 2 + r + t
    if sum < min_sum:
        min_sum = sum
print(min_sum)

a, b, c, x, y = list(map(int, input().split()))
plan_a = c * (2 * x) + max(0, y - x) * b
plan_b = c * (2 * y) + max(0, x - y) * a
plan_c = a * x + b * y
print((min(plan_a, plan_b, plan_c)))


Input:
N = int(input())

a = 1

for n in range(2,N+1):

    a = a*n % (10**9+7)

print(a)

def factorial(N):

    a = 1

    for n in range(2,N+1):

        a = a*n % (10**9 + 7)

    return a

if __name__ == '__main__':

    N = int(input())

    print((factorial(N)))

N = int(input())
a = 1
for n in range(2, N + 1):
    a = a * n % (10**9 + 7)
print(a)

def factorial(N):
    a = 1
    for n in range(2, N + 1):
        a = a * n % (10**9 + 7)
    return a

if __name__ == "__main__":
    N = int(input())
    print((factorial(N)))

-N = int(input())
-a = 1
-for n in range(2, N + 1):
-    a = a * n % (10**9 + 7)
-print(a)
+def factorial(N):
+    a = 1
+    for n in range(2, N + 1):
+        a = a * n % (10**9 + 7)
+    return a
+
+
+if __name__ == "__main__":
+    N = int(input())
+    print((factorial(N)))


Input:
import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

from operator import xor

from functools import reduce

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

a = reduce(xor,(1<<a for a in A))

dp = 0 # bitset

for n in range(K):

    if not(dp&(1<<n)):

        dp |= (a<<n)

answer = 'First' if dp&(1<<K) else 'Second'

print(answer)

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

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

dp = [0]*(K+1) # bitset

for n in range(K):

    if not dp[n]:

        for a in A:

            if n+a>K:

                break

            dp[n+a]=1

answer = 'First' if dp[-1] else 'Second'

print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import xor
from functools import reduce

N, K, *A = list(map(int, read().split()))
a = reduce(xor, (1 << a for a in A))
dp = 0  # bitset
for n in range(K):
    if not (dp & (1 << n)):
        dp |= a << n
answer = "First" if dp & (1 << K) else "Second"
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, *A = list(map(int, read().split()))
dp = [0] * (K + 1)  # bitset
for n in range(K):
    if not dp[n]:
        for a in A:
            if n + a > K:
                break
            dp[n + a] = 1
answer = "First" if dp[-1] else "Second"
print(answer)

-answer = "First" if dp & (1 << K) else "Second"

+answer = "First" if dp[-1] else "Second"


Input:
n = int(input())

ans = 0

SQRT = int(n ** 0.5)

for m in range(1,SQRT + 1):

    b = int(n/m)

    ans += m * (m + b) * (b + 1 - m)

ans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6

print(ans)

def main():

  n = int(input())

  ans = 0

  SQRT = int(n ** 0.5)

  for m in range(1,SQRT + 1):

    b = int(n/m)

    ans += m * (m + b) * (b + 1 - m)

  ans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6

  print(ans)

main()

def main():
    n = int(input())
    ans = 0
    SQRT = int(n**0.5)
    for m in range(1, SQRT + 1):
        b = int(n / m)
        ans += m * (m + b) * (b + 1 - m)
    ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6
    print(ans)

main()


Input:
import math

import collections

N = int(input())

a = math.factorial(N)

check = []

ans = 1

i = 2

while a != 1:

    if a % i == 0:

        a //= i

        check.append(i)

    else:

        i += 1

check = list(collections.Counter(check).values())

for i in check:

    ans *= (i+1)

    ans %= 10**9+7

print(ans)

from math import factorial

N = factorial(int(input()))

i = 2

check = 1

ans = 1

while N != 1:

    if N % i == 0:

        N //= i

        check += 1

    else:

        ans *= check

        check = 1

        i += 1

print(((ans*check)%(10**9+7)))

import math
import collections

N = int(input())
a = math.factorial(N)
check = []
ans = 1
i = 2
while a != 1:
    if a % i == 0:
        a //= i
        check.append(i)
    else:
        i += 1
check = list(collections.Counter(check).values())
for i in check:
    ans *= i + 1
    ans %= 10**9 + 7
print(ans)

from math import factorial

N = factorial(int(input()))
i = 2
check = 1
ans = 1
while N != 1:
    if N % i == 0:
        N //= i
        check += 1
    else:
        ans *= check
        check = 1
        i += 1
print(((ans * check) % (10**9 + 7)))


Input:
A,B,C,X,Y=list(map(int,input().split()))

K=10**9

for i in range(10**5+1):

    S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B

    K=min(K,S)

print(K)

A,B,C,X,Y=list(map(int,input().split()))

a=min(X,Y)*min(A+B,2*C)

a+=max(0,X-Y)*min(A,2*C)

a+=max(0,Y-X)*min(B,2*C)

print(a)

A, B, C, X, Y = list(map(int, input().split()))
K = 10**9
for i in range(10**5 + 1):
    S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B
    K = min(K, S)
print(K)

A, B, C, X, Y = list(map(int, input().split()))
a = min(X, Y) * min(A + B, 2 * C)
a += max(0, X - Y) * min(A, 2 * C)
a += max(0, Y - X) * min(B, 2 * C)
print(a)


Input:
S = int(input())

if S >= 3600:

    h=S//3600

    m=S%3600//60

    s=S%60

elif 3600 > S >= 60:

    h=0

    m=S//60

    s=S%60

else:

    h=m=0

    s=S

print(h, m, s, sep=":")


Input:
_,s=open(c:=0)

for a in sorted(map(int,s.split())):c=a-c

print(c)

for a in sorted(map(int,[*open(c:=0)][1].split())):c=a-c

print(c)

_, s = open(c := 0)
for a in sorted(map(int, s.split())):
    c = a - c
print(c)

for a in sorted(map(int, [*open(c := 0)][1].split())):
    c = a - c
print(c)

+for a in sorted(map(int, [*open(c := 0)][1].split())):


Input:
from statistics import mean

inputCount = int(input())

prices = [int(input()) for lp in range(inputCount)]

average = mean(prices)

print((int(average)))

inputCount = int(input())

prices = [int(input()) for lp in range(inputCount)]

average = sum(prices) // inputCount

print(average)

-from statistics import mean
-average = mean(prices)
-print((int(average)))
+average = sum(prices) // inputCount
+print(average)


Input:
x = int(input())

print((0 if x==1 else 1))

s = input()

if s == '0':

  print((1))

else:

  print((0))

x = int(input())
print((0 if x == 1 else 1))

s = input()
if s == "0":
    print((1))
else:
    print((0))

-x = int(input())
-print((0 if x == 1 else 1))
+s = input()
+if s == "0":
+    print((1))
+else:
+    print((0))


Input:
def binarySearch():

    n = int(input())

    S = set(map(int, input().split()))

    q = int(input())

    T = set(map(int, input().split()))

    print((len(S.intersection(T))))

binarySearch()

def binarySearch():

    n = int(input())

    S = set(input().split())

    q = int(input())

    T = set(input().split())

    print((len(S.intersection(T))))

binarySearch()

-    S = set(map(int, input().split()))
+    S = set(input().split())
-    T = set(map(int, input().split()))
+    T = set(input().split())


Input:
a,b=list(map(int,input().split()))

ans=0

for i in range(a,b+1):

    buf=str(i)

    #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])

    str1=buf[0:int(len(buf)/2)]

    str2=buf[int(len(buf)/2+1):]

    if str1[0]==str2[1] and str1[1]==str2[0]:

        ans+=1

print(ans)

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

ans=0

for i in range(a,b+1):

    buf=str(i)

    str1=buf[::-1]

    if buf==str1:

        ans+=1

print(ans)

a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
    buf = str(i)
    # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])
    str1 = buf[0 : int(len(buf) / 2)]
    str2 = buf[int(len(buf) / 2 + 1) :]
    if str1[0] == str2[1] and str1[1] == str2[0]:
        ans += 1
print(ans)

a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
    buf = str(i)
    str1 = buf[::-1]
    if buf == str1:
        ans += 1
print(ans)

-    # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])

-    str2 = buf[int(len(buf) / 2 + 1) :]


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

RD = list(list(map(int, input().split())) for _ in range(m))

for i in range(1, n + 1):

    ans = 0

    for j in RD:

        ans += j.count(i)

    print(ans)

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

NRD = list(0 for i in range(n))

for i in range(m):

    r1, r2 = list(map(int, input().split()))

    NRD[r1 - 1] += 1

    NRD[r2 - 1] += 1

for i in range(n):

    print((NRD[i]))

-RD = list(list(map(int, input().split())) for _ in range(m))

+    r1, r2 = list(map(int, input().split()))


Input:
N = int(input())

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

cnt = 0

for i in x:

  while i % 2 == 0:

    cnt += 1

    i /= 2

print(cnt)

n = int(input())

ans = 0

for i in map(int, input().split()):

    cnt = 0

    while i % 2 == 0:

        i >>= 1

        cnt += 1

    ans += cnt

print(ans)

-N = int(input())
-x = list(map(int, input().split()))
-cnt = 0
-for i in x:
+n = int(input())
+ans = 0
+for i in map(int, input().split()):
+    cnt = 0
+        i >>= 1
-        i /= 2
-print(cnt)
+    ans += cnt
+print(ans)


Input:
import math

n = int(input())

power = math.factorial(n)

print((power % (10**9 + 7)))

import math

n = int(input())

power = 1

for i in range(1, n+1):

    power = i * power % (10**9 + 7)

print(power)

import math

n = int(input())
power = 1
for i in range(1, n + 1):
    power = i * power % (10**9 + 7)
print(power)

-power = math.factorial(n)
-print((power % (10**9 + 7)))
+power = 1
+for i in range(1, n + 1):
+    power = i * power % (10**9 + 7)
+print(power)


Input:
import math

n = int(input())

print((math.factorial(n)%(10**9+7)))

n = int(input())

pw = 1

for i in range(n):

  pw *= (i+1)

  pw %= 10**9+7

print(pw)

import math

n = int(input())
print((math.factorial(n) % (10**9 + 7)))

n = int(input())
pw = 1
for i in range(n):
    pw *= i + 1
    pw %= 10**9 + 7
print(pw)

-print((math.factorial(n) % (10**9 + 7)))


Input:
A,B = list(map(int,input().split()))

def kaibun(n):

	key = 0

	for i in range(1,n+1):

		if str(i) == str(i)[::-1]:

			key += 1

	return key

print((kaibun(B)-kaibun(A-1)))

A,B = list(map(int,input().split()))

def kaibun(m, n):

	key = 0

	for i in range(m,n+1):

		if str(i) == str(i)[::-1]:

			key += 1

	return key

print((kaibun(A,B)))

A, B = list(map(int, input().split()))

def kaibun(n):
    key = 0
    for i in range(1, n + 1):
        if str(i) == str(i)[::-1]:
            key += 1
    return key

print((kaibun(B) - kaibun(A - 1)))

A, B = list(map(int, input().split()))

def kaibun(m, n):
    key = 0
    for i in range(m, n + 1):
        if str(i) == str(i)[::-1]:
            key += 1
    return key

print((kaibun(A, B)))

-def kaibun(n):
+def kaibun(m, n):
-    for i in range(1, n + 1):
+    for i in range(m, n + 1):
-print((kaibun(B) - kaibun(A - 1)))
+print((kaibun(A, B)))


Input:
from sys import stdin

def solve():

    s = int(stdin.readline())

    mod = 10**9+7

    if s < 3: return 0

    dp = [0]*(s+1)

    dp[0] = 1

    for i in range(3,s+1):

        for x in range(3,i+1):

            if x in [i-1,i-2]:

                continue

            dp[i] += dp[i-x]

    return dp[s]%mod

print((solve()))

from sys import stdin

def solve():

    s = int(stdin.readline())

    mod = 10**9+7

    if s < 3: return 0

    dp = [0]*(s+1)

    dp[0] = 1

    for i in range(3,s+1):

        dp[i] = dp[i-1] + dp[i-3]

    return dp[s]%mod

print((solve()))

from sys import stdin

def solve():
    s = int(stdin.readline())
    mod = 10**9 + 7
    if s < 3:
        return 0
    dp = [0] * (s + 1)
    dp[0] = 1
    for i in range(3, s + 1):
        for x in range(3, i + 1):
            if x in [i - 1, i - 2]:
                continue
            dp[i] += dp[i - x]
    return dp[s] % mod

print((solve()))

from sys import stdin

def solve():
    s = int(stdin.readline())
    mod = 10**9 + 7
    if s < 3:
        return 0
    dp = [0] * (s + 1)
    dp[0] = 1
    for i in range(3, s + 1):
        dp[i] = dp[i - 1] + dp[i - 3]
    return dp[s] % mod

print((solve()))

-        for x in range(3, i + 1):
-            if x in [i - 1, i - 2]:
-                continue
-            dp[i] += dp[i - x]
+        dp[i] = dp[i - 1] + dp[i - 3]


Input:
N = int(input())

s_list = {}

for i in range(N):

  S = input()

  if S in list(s_list.keys()):

    s_list[S] += 1

  else:

    s_list[S] = 0

max = 0

maxs = []

for s,c in list(s_list.items()):

  if c > max:

    maxs = [s]

    max = c

  elif c == max:

    maxs.append(s)

maxs.sort()

for m in maxs:

  print(m)

from collections import Counter

def solve():

  N = int(input())

  S = [input() for _ in range(N)]

  c = Counter(S)

  M = max(c.values())

  ans = []

  for k,v in c.items():

    if v==M:

      ans.append(k)

  ans.sort()

  return ans

print(*solve(),sep='\n')

N = int(input())
s_list = {}
for i in range(N):
    S = input()
    if S in list(s_list.keys()):
        s_list[S] += 1
    else:
        s_list[S] = 0
max = 0
maxs = []
for s, c in list(s_list.items()):
    if c > max:
        maxs = [s]
        max = c
    elif c == max:
        maxs.append(s)
maxs.sort()
for m in maxs:
    print(m)

from collections import Counter

def solve():
    N = int(input())
    S = [input() for _ in range(N)]
    c = Counter(S)
    M = max(c.values())
    ans = []
    for k, v in c.items():
        if v == M:
            ans.append(k)
    ans.sort()
    return ans

print(*solve(), sep="\n")

-N = int(input())
-s_list = {}
-for i in range(N):
-    S = input()
-    if S in list(s_list.keys()):
-        s_list[S] += 1
-    else:
-        s_list[S] = 0
-max = 0
-maxs = []
-for s, c in list(s_list.items()):
-    if c > max:
-        maxs = [s]
-        max = c
-    elif c == max:
-        maxs.append(s)
-maxs.sort()
-for m in maxs:
-    print(m)
+from collections import Counter
+
+
+def solve():
+    N = int(input())
+    S = [input() for _ in range(N)]
+    c = Counter(S)
+    M = max(c.values())
+    ans = []
+    for k, v in c.items():
+        if v == M:
+            ans.append(k)
+    ans.sort()
+    return ans
+
+
+print(*solve(), sep="\n")


Input:
import math

x = int(input())

print((math.factorial(x) % (10**9 + 7)))

M = 1000000007

n=int(input())

f = 1

for i in range(1, n + 1):

    f = (f * i) % M

print(f)

M = 1000000007
n = int(input())
f = 1
for i in range(1, n + 1):
    f = (f * i) % M
print(f)

-print((math.factorial(x) % (10**9 + 7)))


Input:
S = input()

N = len(S)

left = S[:int(N/2)]

right = S[int((N+2)/2):]

S_reversed = "".join(reversed(list(S)))

left_reversed = "".join(reversed(list(left)))

right_reversed = "".join(reversed(list(right)))

if S == S_reversed and left == left_reversed and right == right_reversed:

    print("Yes")

else:

    print("No")

S = input()

N = len(S)

left = S[:int(N/2)]

right = S[int((N+2)/2):]

if S == S[::-1] and left == left[::-1] and right == right[::-1]:

    print("Yes")

else:

    print("No")

S = input()
N = len(S)
left = S[: int(N / 2)]
right = S[int((N + 2) / 2) :]
S_reversed = "".join(reversed(list(S)))
left_reversed = "".join(reversed(list(left)))
right_reversed = "".join(reversed(list(right)))
if S == S_reversed and left == left_reversed and right == right_reversed:
    print("Yes")
else:
    print("No")

S = input()
N = len(S)
left = S[: int(N / 2)]
right = S[int((N + 2) / 2) :]
if S == S[::-1] and left == left[::-1] and right == right[::-1]:
    print("Yes")
else:
    print("No")

-if S == S_reversed and left == left_reversed and right == right_reversed:

+if S == S[::-1] and left == left[::-1] and right == right[::-1]:


Input:
a,b=list(map(int,input().split()))

ans=0

for i in range(b+1)[a:]:

  if len(str(i))%2==0:

    p=list(str(i))[:len(str(i))//2]

    q=list(reversed(list(str(i))[len(str(i))//2:]))

    if p==q:

      ans+=1

  else:

    s=list(str(i))[:len(str(i))//2+1]

    d=list(reversed(list(str(i))[len(str(i))//2:]))

    if s==d:

      ans += 1

print(ans)

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

ad=0

for i in range(a,s+1):

  if str(i)==str(i)[::-1]:ad+=1

print(ad)

a, b = list(map(int, input().split()))
ans = 0
for i in range(b + 1)[a:]:
    if len(str(i)) % 2 == 0:
        p = list(str(i))[: len(str(i)) // 2]
        q = list(reversed(list(str(i))[len(str(i)) // 2 :]))
        if p == q:
            ans += 1
    else:
        s = list(str(i))[: len(str(i)) // 2 + 1]
        d = list(reversed(list(str(i))[len(str(i)) // 2 :]))
        if s == d:
            ans += 1
print(ans)

a, s = list(map(int, input().split()))
ad = 0
for i in range(a, s + 1):
    if str(i) == str(i)[::-1]:
        ad += 1
print(ad)

-        p = list(str(i))[: len(str(i)) // 2]

-        q = list(reversed(list(str(i))[len(str(i)) // 2 :]))

-        d = list(reversed(list(str(i))[len(str(i)) // 2 :]))


Input:
while int(input()) > 0:

    s = sorted(map(int, input().split()))

    print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))

while True:

    if int(input()) == 0:

        break

    s = sorted(map(int, input().split()))

    r = min(abs(x - y) for (x, y) in zip(s, s[1:]))

    print(r)

-    print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))

+    r = min(abs(x - y) for (x, y) in zip(s, s[1:]))


Input:
A, B = list(map(int, input().split()))

numbers = list(range(A, B+1))

count = 0

for i in numbers:

    m = str(i)

    rm = ''.join(list(reversed(m)))

    if m == rm:

        count += 1

print(count)

A, B = list(map(int, input().split()))

x = list(range(1,10))

y = list(range(10))

count = 0

for p in x:

    for q in y:

        for r in y:

            sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))

            if A <= sakasama <= B:

                count += 1

print(count)

A, B = list(map(int, input().split()))
numbers = list(range(A, B + 1))
count = 0
for i in numbers:
    m = str(i)
    rm = "".join(list(reversed(m)))
    if m == rm:
        count += 1
print(count)

A, B = list(map(int, input().split()))
x = list(range(1, 10))
y = list(range(10))
count = 0
for p in x:
    for q in y:
        for r in y:
            sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))
            if A <= sakasama <= B:
                count += 1
print(count)

+            sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))


Input:
k = int(input())

num = 0

if not k%2:

    print((-1))

else:

    for i in range(k):

        num = (num*10+7)%k

        if num == 0:

            print((i+1))

            break

    else:

        print((-1))

K = int(input())

ans = 1

num = 0

seven = 7

if not K%2:

    print((-1))

else:

    for i in range(K):

        num = num + seven

        seven = seven*10%K

        num = num%K

        if num == 0:

            print(ans)

            break

        ans += 1

    else:

        print((-1))

k = int(input())
num = 0
if not k % 2:
    print((-1))
else:
    for i in range(k):
        num = (num * 10 + 7) % k
        if num == 0:
            print((i + 1))
            break
    else:
        print((-1))

K = int(input())
ans = 1
num = 0
seven = 7
if not K % 2:
    print((-1))
else:
    for i in range(K):
        num = num + seven
        seven = seven * 10 % K
        num = num % K
        if num == 0:
            print(ans)
            break
        ans += 1
    else:
        print((-1))

-k = int(input())
+K = int(input())
+ans = 1
-if not k % 2:
+seven = 7
+if not K % 2:
-    for i in range(k):
-        num = (num * 10 + 7) % k
+    for i in range(K):
+        num = num + seven
+        seven = seven * 10 % K
+        num = num % K
-            print((i + 1))
+            print(ans)
+        ans += 1


Input:
k = int(input())

count = 1

n = 0

if k % 2 == 0 or k % 5 == 0:

    print((-1))

else:

  while 1:

      n = (n * 10 + 7) % k

      if n == 0:

        break

      count += 1

  print(count)

def main(h):

  count = 1

  n = 0

  for i in range (k):

    n = (n * 10 + 7) % k

    if n == 0:

      print(count)

      return 0

    count += 1

  print((-1))

if __name__ == '__main__':

  k = int(input())

  main(k)

def main(h):
    count = 1
    n = 0
    for i in range(k):
        n = (n * 10 + 7) % k
        if n == 0:
            print(count)
            return 0
        count += 1
    print((-1))

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

-k = int(input())
-count = 1
-n = 0
-if k % 2 == 0 or k % 5 == 0:
-    print((-1))
-else:
-    while 1:
+def main(h):
+    count = 1
+    n = 0
+    for i in range(k):
-            break
+            print(count)
+            return 0
-    print(count)
+    print((-1))
+
+
+if __name__ == "__main__":
+    k = int(input())
+    main(k)


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

print((c*10 + b + a))

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

print((max(a, b, c)*9 + (a + b + c)))

a, b, c = sorted(map(int, input().split()))
print((c * 10 + b + a))

a, b, c = list(map(int, input().split()))
print((max(a, b, c) * 9 + (a + b + c)))

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

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


Input:
a, b, c, x, y = list(map(int, input().split()))

ans = float('inf')

for i in range(200005):

    tmp = i * 2 * c

    tmp += max(0, x-i) * a

    tmp += max(0, y-i) * b

    ans = min(ans, tmp)

print(ans)

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

ans = float('inf')

for i in range(100005):

    tmp = i * 2 * c

    tmp += max(0, x-i) * a

    tmp += max(0, y-i) * b

    ans = min(ans, tmp)

print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = float("inf")
for i in range(200005):
    tmp = i * 2 * c
    tmp += max(0, x - i) * a
    tmp += max(0, y - i) * b
    ans = min(ans, tmp)
print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = float("inf")
for i in range(100005):
    tmp = i * 2 * c
    tmp += max(0, x - i) * a
    tmp += max(0, y - i) * b
    ans = min(ans, tmp)
print(ans)

-for i in range(200005):
+for i in range(100005):


Input:
N = int(input())

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

def dfs(A_s, index,Bss):

    if index == N:

        tmp = 1

        for b in Bss:

            tmp *= b

        return 1 if tmp % 2 == 0 else 0

    b_mi = Bss.copy()

    b_mi.append(A_s[index] - 1)

    b = Bss.copy()

    b.append(A_s[index])

    b_pl = Bss.copy()

    b_pl.append(A_s[index] + 1)

    return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)

print((dfs(As,0,[])))

N = int(input())

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

tmp = 1

for i in range(N):

    if As[i] % 2 == 0:

       tmp *= 2

print((3 ** N - tmp))

N = int(input())
As = list(map(int, input().split()))

def dfs(A_s, index, Bss):
    if index == N:
        tmp = 1
        for b in Bss:
            tmp *= b
        return 1 if tmp % 2 == 0 else 0
    b_mi = Bss.copy()
    b_mi.append(A_s[index] - 1)
    b = Bss.copy()
    b.append(A_s[index])
    b_pl = Bss.copy()
    b_pl.append(A_s[index] + 1)
    return (
        dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)
    )

print((dfs(As, 0, [])))

N = int(input())
As = list(map(int, input().split()))
tmp = 1
for i in range(N):
    if As[i] % 2 == 0:
        tmp *= 2
print((3**N - tmp))

-        return 1 if tmp % 2 == 0 else 0

-        dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)


Input:
import math

n=int(input())

print((math.factorial(n)%(10**9+7)))

N=int(input())

def fact(n):

    val=1

    for i in range(2,n+1):

        val*=i

        val%=1000000007

    return val

print((fact(N)))

import math

n = int(input())
print((math.factorial(n) % (10**9 + 7)))

N = int(input())

def fact(n):
    val = 1
    for i in range(2, n + 1):
        val *= i
        val %= 1000000007
    return val

print((fact(N)))

-print((math.factorial(n) % (10**9 + 7)))


Input:
n=int(input())

D={}

DD={}

for i in range(1,n+1):

   s=(str(i)[0],str(i)[-1])

   t=(str(i)[-1],str(i)[0])

   if s not in D:

      D[s]=1

   else:

      D[s]+=1

   if t not in DD:

      DD[t]=1

   else:

      DD[t]+=1

ans=0

for i in D:

   if i in DD:

      ans+=D[i]*DD[i]

print(ans)

n=int(input())

D={}

for i in range(1,n+1):

   s=(str(i)[0],str(i)[-1])

   if s in D:

      D[s]+=1

   else:

      D[s]=1

ans=0

for aj,bj in D:

   if (bj,aj) in D:

      ans+=D[(aj,bj)]*D[(bj,aj)]

print(ans)

n = int(input())
D = {}
DD = {}
for i in range(1, n + 1):
    s = (str(i)[0], str(i)[-1])
    t = (str(i)[-1], str(i)[0])
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1
    if t not in DD:
        DD[t] = 1
    else:
        DD[t] += 1
ans = 0
for i in D:
    if i in DD:
        ans += D[i] * DD[i]
print(ans)

n = int(input())
D = {}
for i in range(1, n + 1):
    s = (str(i)[0], str(i)[-1])
    if s in D:
        D[s] += 1
    else:
        D[s] = 1
ans = 0
for aj, bj in D:
    if (bj, aj) in D:
        ans += D[(aj, bj)] * D[(bj, aj)]
print(ans)


Input:
import math

N = int(input())

ans = 0

ans =math.factorial(N) % (10**9 +7)

print(ans)

N = int(input())

power = 1

for i in range(N):

    power = ((i+1) * power) % 1000000007

print(power)

import math

N = int(input())
ans = 0
ans = math.factorial(N) % (10**9 + 7)
print(ans)

N = int(input())
power = 1
for i in range(N):
    power = ((i + 1) * power) % 1000000007
print(power)


Input:
a,b,c,x,y=list(map(int,input().split()))

ans=a*x+b*y

n=max(x,y)

for i in range(1,n+1):

  ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))

print(ans)

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

ans1=a*x+b*y

ans2=2*c*max(x,y)

ans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))

print((min(ans1,ans2,ans3)))

a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
n = max(x, y)
for i in range(1, n + 1):
    ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))
print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans1 = a * x + b * y
ans2 = 2 * c * max(x, y)
ans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))
print((min(ans1, ans2, ans3)))

-    ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))


Input:
answer = 0

N = int(input())

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

for i in range(N) :

    while A[i] % 2 == 0 :

        A[i] = A[i] / 2

        answer += 1

print(answer)

N = int(input())

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

ans = 0

for i in range(N) :

    flag = 0

    while flag == 0 :

        if (L[i] % 2) == 0 :

            ans += 1

            L[i] = L[i]//2

        else :

            flag = 1

print(ans)

answer = 0
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    while A[i] % 2 == 0:
        A[i] = A[i] / 2
        answer += 1
print(answer)

N = int(input())
L = list(map(int, input().split()))
ans = 0
for i in range(N):
    flag = 0
    while flag == 0:
        if (L[i] % 2) == 0:
            ans += 1
            L[i] = L[i] // 2
        else:
            flag = 1
print(ans)

-answer = 0
-A = list(map(int, input().split()))
+L = list(map(int, input().split()))
+ans = 0
-    while A[i] % 2 == 0:
-        A[i] = A[i] / 2
-        answer += 1
-print(answer)
+    flag = 0
+    while flag == 0:
+        if (L[i] % 2) == 0:
+            ans += 1
+            L[i] = L[i] // 2
+        else:
+            flag = 1
+print(ans)


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

ans = 0

for i in range(n, m+1):

    if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1

print(ans)

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

ans = 0

for n in range(a, b+1):

    if str(n) == str(n)[::-1]: ans += 1

print(ans)

n, m = list(map(int, input().split()))
ans = 0
for i in range(n, m + 1):
    if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:
        ans += 1
print(ans)

a, b = list(map(int, input().split()))
ans = 0
for n in range(a, b + 1):
    if str(n) == str(n)[::-1]:
        ans += 1
print(ans)


Input:
ans=[]

for i in range (0,10):

    ans.append(int(input()))

ans.sort(reverse=True)

for i in range (0,3):

    print((ans[i]))

mountain=[]

for s in range(0,10):

    mountain.append(int(input()))

mountain.sort(reverse=True)

for s in range(0,3):

 print((mountain[s]))

ans = []
for i in range(0, 10):
    ans.append(int(input()))
ans.sort(reverse=True)
for i in range(0, 3):
    print((ans[i]))

mountain = []
for s in range(0, 10):
    mountain.append(int(input()))
mountain.sort(reverse=True)
for s in range(0, 3):
    print((mountain[s]))

-ans = []
-for i in range(0, 10):
-    ans.append(int(input()))
-ans.sort(reverse=True)
-for i in range(0, 3):
-    print((ans[i]))
+mountain = []
+for s in range(0, 10):
+    mountain.append(int(input()))
+mountain.sort(reverse=True)
+for s in range(0, 3):
+    print((mountain[s]))


Input:
# -*- coding: utf-8 -*-

import sys

def main():

    S = int( sys.stdin.readline() )

    dp = [0]*(S+1)

    dp[0] = 1

    mod = 10**9 + 7

    for i in range(3, S+1):

        cnt = 0

        for j in range(3, i+1):

            cnt += dp[i-j]

            cnt %= mod

        dp[i] = cnt

    print((dp[-1]))

if __name__ == "__main__":

    main()

# -*- coding: utf-8 -*-

import sys

def main():

    S = int( sys.stdin.readline() )

    dp = [0]*(S+1)

    dp[0] = 1

    mod = 10**9 + 7

    for i in range(3, S+1):

        dp[i] = dp[i-3] + dp[i-1]

        dp[i] %= mod

    print((dp[-1]))

if __name__ == "__main__":

    main()

# -*- coding: utf-8 -*-
import sys

def main():
    S = int(sys.stdin.readline())
    dp = [0] * (S + 1)
    dp[0] = 1
    mod = 10**9 + 7
    for i in range(3, S + 1):
        cnt = 0
        for j in range(3, i + 1):
            cnt += dp[i - j]
            cnt %= mod
        dp[i] = cnt
    print((dp[-1]))

if __name__ == "__main__":
    main()

# -*- coding: utf-8 -*-
import sys

def main():
    S = int(sys.stdin.readline())
    dp = [0] * (S + 1)
    dp[0] = 1
    mod = 10**9 + 7
    for i in range(3, S + 1):
        dp[i] = dp[i - 3] + dp[i - 1]
        dp[i] %= mod
    print((dp[-1]))

if __name__ == "__main__":
    main()

-        cnt = 0
-        for j in range(3, i + 1):
-            cnt += dp[i - j]
-            cnt %= mod
-        dp[i] = cnt
+        dp[i] = dp[i - 3] + dp[i - 1]
+        dp[i] %= mod


Input:
def solve():

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

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

  if K>=N:

    return 0

  H.sort()

  ans = sum(H[:N-K])

  return ans

print((solve()))

def solve():

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

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

  H.sort()

  ans = sum(H[:max(N-K,0)])

  return ans

print((solve()))

def solve():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    if K >= N:
        return 0
    H.sort()
    ans = sum(H[: N - K])
    return ans

print((solve()))

def solve():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    H.sort()
    ans = sum(H[: max(N - K, 0)])
    return ans

print((solve()))

-    if K >= N:
-        return 0
-    ans = sum(H[: N - K])
+    ans = sum(H[: max(N - K, 0)])


Input:
k, s = list(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)

k,s=list(map(int,input().split()))

ans=0

for i in range(k+1):

  num=s-i

  for j in range(min(num+1,k+1)):

    if 0<=num-j<=k:

      ans+=1

print(ans)

k, s = list(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)

k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
    num = s - i
    for j in range(min(num + 1, k + 1)):
        if 0 <= num - j <= k:
            ans += 1
print(ans)

+    for j in range(min(num + 1, k + 1)):


Input:
import sys

N = int(input())

a = [int(input()) for _ in range(N)]

l = 1

p = a[0] - 1

if a[0] == 2:

    print(l)

    sys.exit()

while l < int(1e6):

    l += 1

    if a[p] == 2:

        print(l)

        break

    else:

        p = a[p] - 1

else:

    print((-1))

import sys

N = int(input())

a = [int(input()) for _ in range(N)]

l = 1

p = a[0] - 1

if a[0] == 2:

    print(l)

    sys.exit()

while l < int(2e5):

    l += 1

    if a[p] == 2:

        print(l)

        break

    else:

        p = a[p] - 1

else:

    print((-1))

-while l < int(1e6):
+while l < int(2e5):


Input:
import math

def main():

    N = int(input())

    power = math.factorial(N)

    print((power % (10 ** 9 + 7)))

if __name__ == "__main__":

    main()

def main():

    N = int(input())

    power = 1

    for i in range(1, N + 1):

        power *= i

        power %= 10 ** 9 + 7

    print(power)

if __name__ == "__main__":

    main()

import math

def main():
    N = int(input())
    power = math.factorial(N)
    print((power % (10**9 + 7)))

if __name__ == "__main__":
    main()

def main():
    N = int(input())
    power = 1
    for i in range(1, N + 1):
        power *= i
        power %= 10**9 + 7
    print(power)

if __name__ == "__main__":
    main()

-import math
-    power = math.factorial(N)
-    print((power % (10**9 + 7)))
+    power = 1
+    for i in range(1, N + 1):
+        power *= i
+        power %= 10**9 + 7
+    print(power)


Input:
import math

N = int(input())

ans = math.factorial(N) % (10 ** 9 + 7)

print(ans)

n = int(input())

from functools import reduce

print((reduce(lambda x,y:x*y%1000000007,list(range(1,n+1)))))

import math

N = int(input())
ans = math.factorial(N) % (10**9 + 7)
print(ans)

n = int(input())
from functools import reduce

print((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))

+print((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))


Input:
#python3

INF = int(1e9)

def main():

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

    ans = INF

    for i in range(2*10**5+100):

        t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b

        ans = min(ans, t)

    print(ans)

main()

INF = int(1e5)+5

def main():

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

    ans = INF*INF

    for i in range(INF):

        tmp = 2*i*c + a*max(x-i, 0) + b*max(y-i, 0)

        ans = min(tmp, ans)

    print(ans)

main()

# python3
INF = int(1e9)

def main():
    a, b, c, x, y = list(map(int, input().split()))
    ans = INF
    for i in range(2 * 10**5 + 100):
        t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b
        ans = min(ans, t)
    print(ans)

main()

INF = int(1e5) + 5

def main():
    a, b, c, x, y = list(map(int, input().split()))
    ans = INF * INF
    for i in range(INF):
        tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)
        ans = min(tmp, ans)
    print(ans)

main()


Input:
K,S = list(map(int,input().split(" ")))

ans = 0

for i in range(K+1):

	for j in range(K+1):

		if (S - i - j) <= K and (S-i-j) >= 0:

			ans += 1

print(ans)

K, S = list(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)

K, S = list(map(int, input().split(" ")))
ans = 0
for i in range(K + 1):
    for j in range(K + 1):
        if (S - i - j) <= K and (S - i - j) >= 0:
            ans += 1
print(ans)

K, S = list(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)


Input:
while 1:

    ans=0

    n,x=list(map(int,input().split()))

    if n:

        for i in range(1,n-1):

            for j in range(i+1,n):

                for k in range(j+1,n+1):

                    if i+j+k==x:ans+=1

    else:break

    print(ans)

while 1:

    a=0

    n,x=list(map(int,input().split()))

    if n==0:break

    for i in range(1,n-1):

        for j in range(i+1,n):

            c=x-i-j

            if c>j and c<=n:a+=1

    print(a)

while 1:
    ans = 0
    n, x = list(map(int, input().split()))
    if n:
        for i in range(1, n - 1):
            for j in range(i + 1, n):
                for k in range(j + 1, n + 1):
                    if i + j + k == x:
                        ans += 1
    else:
        break
    print(ans)

while 1:
    a = 0
    n, x = list(map(int, input().split()))
    if n == 0:
        break
    for i in range(1, n - 1):
        for j in range(i + 1, n):
            c = x - i - j
            if c > j and c <= n:
                a += 1
    print(a)

-                for k in range(j + 1, n + 1):


Input:
def main():

  from statistics import mean

  from math import floor,ceil

  n = int(input())

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

  x_mean = mean(x)

  if x_mean == 0.5:

      greater_than_x = len([i for i in x if i > x_mean])

      if greater_than_x * 2 >= n:

          x_mean = ceil(x_mean)

      else:

          x_mean = floor(x_mean)

  elif x_mean % 1 > 0.5:

      x_mean = ceil(x_mean)

  else:

      x_mean = floor(x_mean)

  x2 = [(num - x_mean)**2 for num in x]

  print((sum(x2)))

main()

import sys

read = sys.stdin.read

def main():

    n, *x = list(map(int, read().split()))

    r = float('inf')

    for i1 in range(1, 101):

        rt = 0

        for xe in x:

            rt += (xe - i1)**2

        r = min(r, rt)

    print(r)

if __name__ == '__main__':

    main()

def main():
    from statistics import mean
    from math import floor, ceil

    n = int(input())
    x = list(map(int, input().split()))
    x_mean = mean(x)
    if x_mean == 0.5:
        greater_than_x = len([i for i in x if i > x_mean])
        if greater_than_x * 2 >= n:
            x_mean = ceil(x_mean)
        else:
            x_mean = floor(x_mean)
    elif x_mean % 1 > 0.5:
        x_mean = ceil(x_mean)
    else:
        x_mean = floor(x_mean)
    x2 = [(num - x_mean) ** 2 for num in x]
    print((sum(x2)))

main()

import sys

read = sys.stdin.read

def main():
    n, *x = list(map(int, read().split()))
    r = float("inf")
    for i1 in range(1, 101):
        rt = 0
        for xe in x:
            rt += (xe - i1) ** 2
        r = min(r, rt)
    print(r)

if __name__ == "__main__":
    main()

-    x = list(map(int, input().split()))

-        greater_than_x = len([i for i in x if i > x_mean])

-    x2 = [(num - x_mean) ** 2 for num in x]

+    n, *x = list(map(int, read().split()))


Input:
from collections import defaultdict

N = int(input())

A = [input() for _ in range(N)]

A.sort()

d = defaultdict(int)

for a in A:

    d[a] += 1

l = sorted(d.items())

max_v = 0

for _, v in l:

    if v > max_v:

        max_v = v

for k, v in l:

    if v == max_v:

        print(k)

    else:

        continue

from collections import defaultdict

def solve():

    N = int(input())

    d = defaultdict(int)

    for _ in range(N):

        a = input()

        d[a] += 1

    m = 0

    for k, v in list(d.items()):

        m = max(m, v)

    l = []

    for k, v in list(d.items()):

        if m == v:

            l.append(k)

    l.sort()

    for ans in l:

        print(ans)

solve()

-N = int(input())
-A = [input() for _ in range(N)]
-A.sort()
-d = defaultdict(int)
-for a in A:
-    d[a] += 1
-l = sorted(d.items())
-max_v = 0
-for _, v in l:
-    if v > max_v:
-        max_v = v
-for k, v in l:
-    if v == max_v:
-        print(k)
-    else:
-        continue
+
+def solve():
+    N = int(input())
+    d = defaultdict(int)
+    for _ in range(N):
+        a = input()
+        d[a] += 1
+    m = 0
+    for k, v in list(d.items()):
+        m = max(m, v)
+    l = []
+    for k, v in list(d.items()):
+        if m == v:
+            l.append(k)
+    l.sort()
+    for ans in l:
+        print(ans)
+
+
+solve()


Input:
n = int(input())

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

a_index = []

for i in range(n):

    a_index.append((i, a[i]))

dic1 = {}

dic2 = {}

for i in range(n):

    one = a_index[i][0] + a_index[i][1]

    two = a_index[i][0] - a_index[i][1]

    if one not in dic1:

        dic1[one] = 1

    else:

        dic1[one] += 1

    if two not in dic2:

        dic2[two] = 1

    else:

        dic2[two] += 1

ans = 0

for i in list(dic1.keys()):

    if i in dic2:

        ans += dic2[i] * dic1[i]

for i in list(dic2.keys()):

    if i in dic1:

        ans += dic1[i] * dic2[i]

        #print(i)

print((ans // 2))

n = int(input())

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

import collections

ans = 0

dic = collections.defaultdict(int)

for i in range(1, n + 1):

    ans += dic[i - a[i - 1]]

    dic[i + a[i - 1]] += 1

print(ans)

n = int(input())
a = list(map(int, input().split()))
a_index = []
for i in range(n):
    a_index.append((i, a[i]))
dic1 = {}
dic2 = {}
for i in range(n):
    one = a_index[i][0] + a_index[i][1]
    two = a_index[i][0] - a_index[i][1]
    if one not in dic1:
        dic1[one] = 1
    else:
        dic1[one] += 1
    if two not in dic2:
        dic2[two] = 1
    else:
        dic2[two] += 1
ans = 0
for i in list(dic1.keys()):
    if i in dic2:
        ans += dic2[i] * dic1[i]
for i in list(dic2.keys()):
    if i in dic1:
        ans += dic1[i] * dic2[i]
        # print(i)
print((ans // 2))

-    one = a_index[i][0] + a_index[i][1]

-    two = a_index[i][0] - a_index[i][1]