peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N, M  = map(int, input().split())
PY = [list(map(int, input().split())) for i in range(M)]

A = []
for i in range(M):
  A.append([0,1000000000000])

for i in range(M):
  PY[i].extend(A[i])

PY.sort

P = 0


for i in range(M):
  if P != PY[i][0]:
    P = PY[i][0]
    S = 1

  else:
    S += 1

  PY[i][3] += PY[i][0]*1000000+S

PY.sort(key=lambda x: x[2])

for i in range(M):
  ans = str(PY[i][3])
  print(ans[1:])
# Judge status: Wrong Answer
# D - I hate Factorization
def meet_condition(i, j):
	pi = pows[i]
	pj = pows[j]
	
	if pi - pj == x:
		return i, j
	elif pi + pj == x:
		return i, -j


pows = []

for i in range(100):
	pows.append(pow(i, 5))

x = int(input())

for i in range(len(pows)):
	for j in range(len(pows)):
		if meet_condition(i, j) != None:
			a, b = meet_condition(i, j)
			print(a, b)
			exit()
# Judge status: Accepted
N = input()

N_10 = int(N[0])
N_1 = int(N[1])


if (N_10 != 9) and (N_1 != 9):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
s=int(input())
dp=[0]*(s+1)
dp[0]=1
mod=10**9+7
x=0
for i in range(1,s+1):
    if i-3>=0:
        x+=dp[i-3]
        x%=mod
        dp[i]=x
print(dp[s])
# Judge status: Accepted
X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort()
q.sort()
r.sort()
l = p[-X:] + q[-Y:]
l.sort()

for i in range(min(X+Y,C)):
  if l[i] < r[-1]:
    l[i] = r.pop()


ans = sum(l)
print(ans)
# Judge status: Accepted
n=int(input())
num=list(map(int,input().split()))
num.sort()

i,cnt,ans=1,1,0
m=num[0]
while i<n:
    if num[i]==m:
        cnt+=1
    else:
        if cnt<m:
            ans+=cnt
        elif cnt>m:
            ans+=cnt-m
        m=num[i]
        cnt=1
    i+=1
if cnt<m:
  ans+=cnt
elif cnt>m:
  ans+=cnt-m
print(ans)
# Judge status: Accepted
from itertools import combinations_with_replacement

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

ans = 0
for c in combinations_with_replacement(range(1,m+1),n):
    v = 0
    for s in s_list:
        if c[s[1]-1] - c[s[0]-1] == s[2]:
            v+=s[3]
    
    ans = max(ans,v)
print(ans)
# Judge status: Accepted
N,*A=map(int,open(0).read().split())
B=[abs(i) for i in A]
print(sum(B)-2*min(B)if len([i for i in A if i<0])%2 else sum(B))
# Judge status: Wrong Answer
N , K = map(int,input().split())
B = {}
C = {}
D = {0}
A = list(map(int,input().split()))
place = 0
num = 0
C[0] = 0
while True:
    place = int(A[place]) - 1
    num += 1   
    if place in D:
        Y = int(num) - int(C[place])
        break
    elif num == K:
        break
    else:
        B[num] = place
        C[place] = num
        D.add(place)
try:
    X = (K - num) % Y
    print(B[C[place] + X] + 1)
except:
    print(A[place])
# Judge status: Wrong Answer
n = int(input())
lst = list(map(int, input().split()))

c = 0
for i in range(n):
  if i % 2 == 1:
    if lst[i] % 2 == 1:
      c += 1
print(c)
# Judge status: Accepted
#083_C
x, y = map(int, input().split())
z = y // x

for i in range(10**18):
    if x * pow(2,i) > y:
        print(i)
        break
# Judge status: Accepted
R = lambda: map(int, input().split())
n, m = R()
h = [None, *R()]
g = [0] + [1] * n
for _ in range(m):
  a, b = R()
  if h[a] <= h[b]:
    g[a] = 0
  if h[b] <= h[a]:
    g[b] = 0
print(sum(g))
# Judge status: Accepted
a,b = input().split()

a=int(a)
b=int(b)

if a>=1 and a<=9 and b>=1 and b<=9:
    print(a*b)
else: print("-1")
# Judge status: Wrong Answer
C = []
for _ in range(3):
    c = list(map(int, input().split()))
    C.append(c)

s0 = 0
for i in range(3):
    for j in range(3):
        s0 += C[i][j]

s1 = 0
for j in range(3):
    for i in range(3):
        s1 += C[i][j]

if s0 == s1 and s0%3 == 0 and s1%3 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

divide = 0

i = 0
while i < n:
    while i+1 < n and a[i] == a[i+1]:
        i += 1

    if i+1 < n and a[i] < a[i+1]:
        while i+1 < n and a[i] <= a[i+1]:
            i += 1

    elif i+1 < n and a[i] > a[i+1]:
        while i+1 < n and a[i] >= a[i+1]:
            i += 1

    divide += 1
    i += 1

print(divide)
# Judge status: Wrong Answer
"""B - Judge Status Summary"""
N = int(input())
ac, wa, tle, re = 0, 0, 0, 0
for i in range(N):
    S = input()
    if S == "AC":
        ac = +1
    elif S == "WA":
        wa = +1
    elif S == "TLE":
        tle = +1
    else:
        re = +1

print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
max = 60
ans = 0
mod = 10**9 + 7
for i in range(max):
    one = 0
    for ai in a:
        if (ai >> i) & 1:
            one += 1
    ans += one*(n - one)*2**i
ans %= mod
print(ans)
# Judge status: Accepted
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()

if s==u:
  print(a-1,b)
  
elif t==u:
  print(a,b-1)
# Judge status: Accepted
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(M)]

ans = min(a) + min(b)
for i in range(M):
    x, y, c = xyc[i]
    x -= 1
    y -= 1
    cost = a[x] + b[y] - c
    ans = min(ans, cost)
print(ans)
# Judge status: Accepted
import sys

line = sys.stdin.readline()
n = int(line)
if n == 1:
    print(1)
elif n % 2 == 0:
    print(0.5)
else:
    print(0.5 + (0.5 / n))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

a.append(90)
money=1000
kabu=0
for i in range(n):
  if a[i+1] > a[i]:
    kabu+=int(money/a[i])
    money-=a[i]*int(money/a[i])
  elif a[i+1] < a[i]:
    money+=kabu*a[i]
    kabu=0
print(money)
# Judge status: Wrong Answer
N, A, B, C, D = map(int, input().split())
S = input()

from sys import exit

# check
if "##" in S:
    print("No")
    exit()

if C < D:
    # Bから先に動く
    print("Yes")

else:
    # 入れ替わる必要がある

    # cehck : 初期値で入れ替えられる
    if "..." in S[B-2:D]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
S = list(input())
for i in range(len(S)-1):
    del S[-1]
    if S[0:len(S)//2]==S[len(S)//2:]:
        print(len(S))
# Judge status: Wrong Answer
N = int(input())
X = list(map(int, input().split()))
X.sort()
a = -1
for i in range(X[0], X[-1]):
    b = 0
    for y in X:
        b += (y - i)**2
    if a == -1 or b < a:
        a = b
    elif a < b:
        break
print(a)
# Judge status: Accepted
n, x, y = list(map(int, input().split()))
x = x-1
y = y-1
ans = [0] * (n-1)


for i in range(n):
    for j in range(i+1, n):
        shortest = min(abs(j-i), abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1)
        ans[shortest-1] += 1

for a in ans:
    print(a)
# Judge status: Wrong Answer
a = input()
if a[0] != a[1] != a[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
isIn = False
for i in range(N - M + 1):
    for j in range(N - M + 1):
        isOK = True
        for now in range(M):
            if A[i+now][j:j+M] != B[now]:
                isOK = False
                break
        if isOK:
            isIn = True
            break
    if isIn:
        break
if isIn:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque

n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

l = deque([])
cnt = 0
for i in range(n):
    if len(l) > 0:
        if l[0] + k < t[i]:
            cnt += 1
            l = deque([])
    l.append(t[i])

    if len(l) >= c:
        cnt += 1
        l = deque([])
if len(l) > 0:
    cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
A = int(input())
if N%500 > A:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
A,B=map(int,input().split())
if (((A+B)//3)>0):
    print ("Possible")
else:
    print ("Impossible")
# Judge status: Accepted
import math
S=int(input())
count = 1
if S>=3:
    i=1
    while S>=3*(i+1):
        count += math.factorial(S-3*(i+1)+i)//(math.factorial(S-3*(i+1))*math.factorial(i))
        i+=1
    print(count%1000000007)
else:
    print(0)
# Judge status: Accepted
x = list(map(int,input().split(" ")))
n,m = x

# A = [int(input()) for _ in range(3)]

m_list = [n] * m
# print(m_list)

for i in range(n):
    ka = list(map(int,input().split(" ")))
    # print(ka)
    k = int(ka[0])
    # print(k)
    for j in range(k):
        m_list[ka[j+1]-1] -= 1
        # print(m_list)
# print(m_list)
count0 = m_list.count(0)
print(count0)
# Judge status: Accepted
S = list(input().split('/'))
S = int(''.join(S))

if S > 20190430:
    print('TBD')
else:
    print('Heisei')
# Judge status: Accepted
n = int(input())
s = 7
for i in range(1, int(3e6)):
    if s%n == 0:
        print(i)
        exit()
    s = (s*10 + 7) % n
print(-1)
# Judge status: Accepted
import numpy as np
N, M = map(int, input().split())
A = np.array([list(input()) for i in range(N)])
B = np.array([list(input()) for i in range(M)])

for i in range(N-M+1):
    for j in range(N-M+1):
        if (A[i:i+M, j:j+M] == B).all():
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
from collections import defaultdict

N = int(input())
if not N == 1:
    counter = defaultdict(lambda: 0)
    for e in list(map(int, input().split())):
        counter[e] += 1
    answer = 0
    # この行がバグの原因
    for i in range(1, N+1):
        ball_count = counter[i]
        if i > ball_count:
            answer += ball_count
        elif i < ball_count:
            answer += ball_count - i
    print(answer)
else:
    if not 1 == int(input()):
        print(1)
    else:
        print(0)
# Judge status: Wrong Answer
S = list(input())
for i in range(0,3,1):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Yes")
# Judge status: Accepted
s = int(input())

def func(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1


a_list = [s]
i = 1
while True:
    if i == 1:
        pass
    else:
        n = a_list[i-2]
        a_list.append(func(n))
    i += 1
    if len(a_list) != len(set(a_list)):
        print(len(a_list))
        break
# Judge status: Accepted
import math


n, d = map(int, input().split())
x = []
for i in range(n):
    x.append(list(map(int, input().split())))

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        y = 0
        for k in range(d):
            y += (x[i][k] - x[j][k])**2

        y = math.sqrt(y)
        if y.is_integer():
            ans += 1
print(ans)
# Judge status: Accepted
x = int(input())
ans = 10 - x // 200
print(ans)
# Judge status: Accepted
def main():
    s, t = [x for x in input().split()]
    a, b = [int(x) for x in input().split()]
    u = input()
    print(a-(s==u), b-(t==u))


if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    D, T, S = map(int, input().split())
    if T >= (D/S):
        print("Yes")
    else:
        print("No")
    
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))

seed = h[0]
checker = True

for i in range(1,n):
    if h[i] == h[i-1]:
        continue
    d = h[i] - h[i-1] + 1
    if d > 0:
        checker = True
        pass
    elif d == 0:
        if checker:
            checker = False
        else:
            print('No')
            quit()
    else:
        print('No')
        quit()


print('Yes')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
 
flag = True
count = 0
while(flag):
  for i in range(N):
    if A[i]%2:
      flag = False
      break
    else:
      A[i] /= 2
  if flag:
    count += 1
print(count)
# Judge status: Accepted
def not_xxx(N):
    X = list(str(N))
    if len(set(X)) == 1:
        return False
    else:
        return True

N = int(input())

while not_xxx(N):
    N += 1

print(N)
# Judge status: Accepted
H = int(input())

num = 1
cnt = 0

while H >= 1:
    cnt += num
    num *= 2
    H = H//2
print(cnt)
# Judge status: Accepted
W, H, N = map(int, input().split())
min_H = 0
min_W = 0
max_H = H
max_W = W

for _ in range(N):
    x, y, a = map(int, input().split())

    if a == 1:
        min_W = max(x, min_W)
    elif a == 2:
        max_W = min(x, max_W)
    elif a == 3:
        min_H = max(y, min_H)
    else:
        max_H = min(y, max_H)

if min_W > max_W or min_H > max_H:
    print(0)
else:
    print((max_H - min_H) * (max_W - min_W))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
j = 1
for i in range(N):
  if a[i] == j:
    j += 1
    ans = N-j+1
if j == 1:
  ans = -1
print(ans)
# Judge status: Wrong Answer
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

n,l = imap()
s = []
for i in range(n): s.append(sinput())

ans = "".join(s)
print(ans)
# Judge status: Accepted
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else :
    print('No')
# Judge status: Wrong Answer
x = int(input())

cnt = 0
i = 1

while cnt >= x:
    cnt += i
    i += 1

print(i-1)
# Judge status: Wrong Answer
from math import gcd

N = int(input())
A = list(map(int, input().split()))
left = [0] * N
x = A[0]
for i in range(N):
    x = gcd(x,A[i])
    left[i] = x

right = [0] * N
x = A[-1]
for i in range(N):
    x = gcd(x,A[N-i-1])
    right[i] = x
v = [0] * N
v[0] = right[-2]
v[-1] = left[-2]
for i in range(1,N-1):
    print(left[i-1],right[i-1])
    v[i] = gcd(left[i-1], right[i-1])

print(max(v))
# Judge status: Accepted
n=input()
for i in range(2):
    if n[i]==n[i+1]==n[i+2]:
        print('Yes')
        exit()
print ('No')
# Judge status: Accepted
from fractions import gcd

def prime_factor(n):
    factors = set()
    i = 2
    while i * i <= n:
        while n % i == 0:
            factors.add(i)
            n //= i
        i += 1
    if n != 1:
        factors.add(n)
    return factors

A, B = map(int, input().split())
print(len(prime_factor(gcd(A, B))) + 1)
# Judge status: Wrong Answer
# -*- coding: utf-8-*-

N = int(input())

print(N*(N+1)/2)
# Judge status: Wrong Answer
def solve():
    L, R = map(int, input().split())

    if L + 2019 < R:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return (list[0] * list[1]) % 2019

print(solve())
# Judge status: Wrong Answer
a = int(input())
b = input()
print("red" if a>=3200 else b)
# Judge status: Accepted
N = int(input())
detayatsu = dict()
ans = 0
for i in range(N):
    S_i = "".join(sorted(list(input())))
    if S_i in detayatsu.keys():
        ans += detayatsu[S_i]
        detayatsu[S_i] += 1
    else:
        detayatsu[S_i] = 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
li = list(map(int, input().split()))

li.sort()

sum = 0
for i in li[:-2]:
    sum = i + sum

Nmax = li[-1]
if N <= 2:
    print("No")
elif Nmax >= sum:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
print("Christmas" + " Eve " * (25 - n))
# Judge status: Wrong Answer
def count_up(d, cut):
    ABC = len([1 for i in d if i < cut])
    ARC = len(d) - ABC
    if ABC == ARC:
        return True
    return False

N = int(input())
d = list(map(int, input().split()))
avg = sum(d) // len(d)
counter = 0
if count_up(d, avg):
    counter += 1
    _avg = avg - 1
    while count_up(d, _avg):
        counter += 1
        _avg -= 1
    _avg = avg + 1
    while count_up(d, _avg):
        counter += 1
        _avg += 1
print(counter)
# Judge status: Accepted
N = int(input())
ABlist = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0
for a, b in ABlist[::-1]:
    a += ans
    if a % b == 0:
        continue
    else:
        ans += (b - a % b)
print(ans)
# Judge status: Accepted
S=input()
N=len(S)+1
LEFT=[0]
RIGHT=[0]
left=0
right=0
for i in range(N-1):
  if S[i]==">":
    left=0
  else:
    left+=1
  LEFT+=[left]
for i in range(N-2,-1,-1):
  if S[i]=="<":
    right=0
  else:
    right+=1
  RIGHT+=[right]
ans=0  
for i in range(N):  
  ans+=max(LEFT[i],RIGHT[N-1-i])
print(ans)
# Judge status: Wrong Answer
X, Y = map(int, input().split())
print(X + Y/2)
# Judge status: Wrong Answer
a, b, c = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
 
if a==b:
	if a!=c:
		print("YES")
	else:
		print("NO")
elif a==c:
  print("YES")
elif b==c:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = int(input())
xlt = []
for i in range(n):
    xi,li = map(int,input().split())
    xlt.append((xi+li,xi-li))
xlt.sort()
ans = 0
x = -float("INF")
for i in range(n):
    if x <= xlt[i][1]:
        ans += 1
        x = xlt[i][0]
print(ans)
# Judge status: Accepted
from math import ceil,log2
n,k=map(int,input().split())
ans=0
for i in range(n):
    ans+=(1/n)*(1/2)**max(0,ceil(log2(k/(i+1))))
print(ans)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [int(i) for i in input().split()]

s_set = set(s)

counted = Counter(s)
ans = sum(i*(i-1)/2 for i in counted.values())
print(ans)

for i in s:
    x = counted[i]
    print(int(ans - x + 1))
# Judge status: Accepted
sx, sy, tx, ty = list(map(int, input().split()))

dx = tx - sx
dy = ty - sy
d1 = ['U']*dy + ['R']*dx
d2 = ['D']*dy + ['L']*dx
d3 = ['L'] + ['U']*(dy+1) + ['R']*(dx+1) + ['D']
d4 = ['R'] + ['D']*(dy+1) + ['L']*(dx+1) + ['U']

print(''.join(d1+d2+d3+d4))
# Judge status: Wrong Answer
n=int(input())
flag=0
for i in range(int(n//4)+1):
  for j in range(int(n//7)+1):
    if n==(i*4+j*7):
      print("Yes")
      print(i,j)
      flag=1
      break
  if flag==1:
    break
if flag==0:
  print("No")
# Judge status: Accepted
X=int(input())
a=100

for i in range(1,10**18):
    a=int(a*1.01)
    if X<=a:
        print(i)
        exit()
# Judge status: Wrong Answer
n, a, b = map(int, input().split(" "))
from math import factorial
c = n
ans = c

for i in range(1, int(n // 2 - 1)):
    c *= (n - i) / (i + 1)
    if i + 1 != a and i + 1 != b:
        ans += c % (10 ** 9 + 7)
ans *= 2
ans += 1
if n % 2 == 0:
    ans += factorial(n) / factorial(n - n / 2) / factorial(n / 2)
ans -= factorial(n) / factorial(n - a) / factorial(a)
ans -= factorial(n) / factorial(n - b) / factorial(b)
print(ans)
# Judge status: Accepted
from functools import reduce

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


def f(x):
    c = 0
    while x % 2 == 0:
        x //= 2
        c += 1
    return c


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


nth = [f(ai) for ai in a]
if len(set(nth)) == 1:
    half_a = [ai >> 1 for ai in a]
    L = reduce(lambda x, y: x * y // gcd(x, y), half_a)
    ans = (M - L) // (2 * L) + 1 if M >= L else 0
else:
    ans = 0
print(ans)
# Judge status: Accepted
A,B,T=map(int,input().split())
print(B*(T//A))
# Judge status: Accepted
N=input()
if N==('SSS'):
    print(0)

if N==('SSR'):
    print(1)

if N==('SRS'):
    print(1)

if N==('RSR'):
    print(1)

if N==('RSS'):
    print(1)

if N==('SRR'):
    print(2)

if N==('RRS'):
    print(2)

if N==('RRR'):
    print(3)
# Judge status: Wrong Answer
from collections import defaultdict
n = int(input())
x = {i: 10000 for i in "abcdefghijklmnopqrstuvwxyz"}
for _ in range(n):
    s = defaultdict(int)
    for i in input():
        s[i] += 1
    for i in "abcdefghijklmnopqrstuvwxyz":
        x[i] = min(x[i], s[i])
ans = ""
for i, v in x.items():
    ans += i * v
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    ans += min(A[i], B[i])
    B[i] -= min(A[i], B[i])
    ans += min(A[i+1], B[i])
    A[i+1] -= min(A[i+1], B[i])

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

AB = sorted(
  [ list(map(int, input().split())) for _ in range(N) ],
  key = lambda x : x[0]
)

ans = 0
for a, b in AB:
  if M <= b:
    ans += a * M
    break
  ans += a * b
  M -= b
print(ans)
# Judge status: Accepted
n = int(input())
l = []
ans = 'Yes'
ps = 'a'
for i in range(n):
  s = input()
  if s in l:
    ans = 'No'
  l.append(s)
  if i != 0 and ps[-1] != s[0]:
    ans = 'No'
  ps = s

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

n = int(input())
p = n
count = 0

for i in range(2, int(sqrt(n)) + 1):
    e = 1
    while n % i ** e == 0:
        n //= i ** e
        count += 1
        e += 1
    if n % i == 0:
        while n % i == 0:
            n //= i

if n != 1:
    count += 1
if count == 0 and p != 1:
    count = 1

print(count)
# Judge status: Accepted
s=input()
ans=1000
for i in range(len(s)-2):
    ans=min(ans,abs(int(s[i:i+3])-753))
print(ans)
# Judge status: Wrong Answer
a = int(input())
print(a * 800 - (a % 15 *200))
# Judge status: Accepted
k = int(input())

m = 0

for i in range(1, 10**6):
    n = m *10 +7
    m = n % k
    if m == 0:
        print(i)
        exit(0)

print(-1)
# Judge status: Wrong Answer
Q, H, S, D = map(int, input().split())
N = int(input())
q, h, s, d = Q * 4, H * 2, S, D / 2
if N == 1:
    ans = int(min(q, h, s))
elif N % 2 == 0:
    ans = int(N * min(q, h, s, d))
else:
    ans = int((N - 1) * min(q, h, s, d) + min(q, h, s))
print(ans)
# Judge status: Wrong Answer
K,S=map(int,input().split())

count=0

for A in range(2*K+1):
        for Z in range(K+1):
            if A+Z==S:
                count+=1

print(count*2)
# Judge status: Accepted
a, b = map(int, input().split())

if (a * b) %2 ==0:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
A, B = map(int, input().split())
if (A > 8) or (B > 8):
    print(':(')
else:
    print('Yay!')
# Judge status: Accepted
A=int(input())
ans=0

for i in range(4):
    B=int(input())
    if A%10>B%10>0: A,B=B,A
    ans+=-(-B//10)*10

print(A+ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>=b:
  print(b*a)
else:
  print(a*b)
# Judge status: Wrong Answer
n,m = map(int,input().split())

check = [1]+[0]*n
numlis = [1]*(n+1)

for i in range(m):
    x, y = map(int, input().split())
    if numlis[x-1] > 1 and check[x-1] == 1:
        check[y-1] = 1
        numlis[x-1] -= 1
        numlis[y-1] += 1
    elif numlis[x-1] == 1 and check[x-1] == 1:
        check[y-1] = 1
        check[x-1] = 0
        numlis[x-1] -= 1
        numlis[y-1] += 1

    
print(sum(check))
# Judge status: Accepted
X = int(input())

tmp = 100
cnt = 0
while tmp < X:
    tmp = tmp + int(tmp*0.01)
    cnt += 1

print(cnt)
# Judge status: Wrong Answer

def solve():
    k = 0
    N = n
    ans = ""
    while N:
        k+=1
        if N % 2 == 1:
#            print("------\t" + str(N))
            N -= 1
            ans += "1"
        else:
            ans += "0"
        N //= (-2)  # n=-2 進数
#        print(N)
#    print(k)    #   桁数
    print(ans[::-1])
#    print(a[::-1])



if __name__=="__main__":
    n = int(input())
    solve()
# Judge status: Wrong Answer
BOX = [int(j) for j in input().split(' ')]
if len([j for j in BOX if j % 2 == 0]) > 0:
    print(0)
else:
    BOX.sort(reverse=True)
    print(int(((BOX[0] / 2 + BOX[0] % 2) * BOX[1] * BOX[2]) - (BOX[0] / 2  * BOX[1] * BOX[2])))
# Judge status: Accepted
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())
L=[a,b,c,d,e]

a1=int(a[-1])
b1=int(b[-1])
c1=int(c[-1])
d1=int(d[-1])
e1=int(e[-1])
l1=[a1,b1,c1,d1,e1]

ans=0
flag=0
m=0
for i in range(5):
  if l1[i]==0:
    ans+=int(L[i])
  else:
    flag=1
    s=10-l1[i]
    ans+=int(L[i])+s
    if m<s:
      m=s
if flag==1:
  ans-=m
print(ans)
# Judge status: Wrong Answer
s=input()
nall=len(s)
nzero=s.count("0")
none=nall-nzero
if nall==0:
    print(0)
elif none<=nzero:
    print(nall-none*2)
else:
    print(nall-nzero*2)
# Judge status: Wrong Answer
# A - Colorful Subsequence
import numpy as np

N,S = int(input()),input()
count = np.zeros(26)

for i in range(N):
    count[ord(S[i])-ord('a')] += 1

ans = 1
for i in range(26):
    ans *= (count[i]+1)

print(int((ans-1)%(10**9+7)))