peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from collections import defaultdict
from bisect import bisect_right

dic_PY = defaultdict(list)
N, M = map(int, input().split())
PY = [list(map(int, input().split())) for _ in range(M)]
for p, y in sorted(PY):
  dic_PY[p] += [y]
  
for p, y in PY:
  z = bisect_right(dic_PY[p], y)
  print("%06d%06d"%(p,z))
# Judge status: Accepted
#D
N = int(input())
A = list(map(int,input().split()))

price=1000 #現金
stock=0 #株数
for n in range(N-1):
    next_ = n+1
    
    if A[n] < A[next_]: #買い
        if price >= A[n]:#買える場合
            stock = price//A[n]
            price = price - A[n]*stock
        
    elif A[n] > A[next_]: #売り
        price = price + A[n]*stock
        stock = 0
        
price = price + A[-1]*stock
stock = 0
print(price)
# Judge status: Accepted
n = int(input())
s = input()
x = 0
ans = 0
for i in range(n):
  if s[i] == 'I':
    x += 1
  elif s[i] == 'D':
    x -= 1
  ans = max(ans, x)
print(ans)
# Judge status: Wrong Answer
S = input()
T = input()

s = len(S)
t = len(T)

if (S == T[:s]) & (t == s+1):
    print("yes")
else:
    print("no")
# Judge status: Accepted
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

import itertools
X = list(itertools.permutations(range(1,N+1),N))
for i in range(len(X)):
  x = X[i]
  if P == x:
    a = i 
  if Q == x:
    b = i

print(abs(a-b))
# Judge status: Wrong Answer
l=int(input())
res=0
for i in range(1,l-1):
    for j in range(1,l-1):
        s=l-i-j
        if res<i*j*s:
            res=i*j*s
print(res)
# Judge status: Wrong Answer
n=int(input())
s=[]
d=[]
for i in range(n):
    x,y=map(int,input().split())
    s.append(abs(x+y))
    d.append(abs(x-y))
l=[]
for i in range(n):
  for j in range(i+1,n):
    l.append(max(abs((s[i]-s[j])),abs((d[i]-d[j]))))
print(max(l))
# Judge status: Wrong Answer
x = input()
if x==3 or x==5 or x==7:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n, k = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    score = i
    rate = (1 / n)
    while score < k:
        score *= 2
        rate *= (1 / 2)
    ans += rate

print(ans)
# Judge status: Accepted
l = list(map(int, input().split()))
k = int(input())
num = max(l)
l.remove(num)
for i in range(k):
    num = num * 2
print(sum(l) + num)
# Judge status: Accepted
n = int(input())
lr = []
for _ in range(n):
    x, l = map(int, input().split())
    lr.append((x-l, x+l))
lr = sorted(lr, key=lambda x:x[0])
prev = lr[0]
ans = 1
for i in range(1, n):
    if prev[1] <= lr[i][0]:
        ans += 1
        prev = lr[i]
    else:
        if prev[1] > lr[i][1]:
            prev = lr[i]

print(ans)
# Judge status: Wrong Answer
A=int(input())
B=int(input())
C=int(input())
X=int(input())
out=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = A*i + B*j + C*k
            if sum==X:
                out+=1
print(out)
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=float("inf")
for i in range(n-k+1):
    left = x[i]
    right = x[i+k-1]
    ans = min(ans,abs(left)+abs(right - left),abs(right) + abs(right - left))
print(ans)
# Judge status: Accepted
s = list(input())
t = list(input())
checker = 0
for i in range(len(s)-len(t), -1, -1):
    if all(s[i+j]==t[j] or s[i+j]=="?" for j in range(len(t))):
        checker = 1
        for j in range(len(t)):
            s[i+j] = t[j]
        s = ["a" if s[I]=="?" else s[I] for I in range(len(s))]
        break
if checker:
    print("".join(s))
else:
    print("UNRESTORABLE")
# Judge status: Accepted
s = int(input())
MOD = 10 ** 9 + 7

s_list = [0] * (s + 1)

for i in range(3, s + 1):
    temp = 1
    for j in range(i - 3):
        temp += (s_list[j+1]) % MOD
    s_list[i] = temp % MOD

print(s_list[s])
# Judge status: Accepted
S, T = input().split()
A, B = [int(_) for _ in input().split()]
U = input()

if U == S:
    print(A-1, B)
elif U == T:
    print(A, B-1)
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    D=[int(_) for _ in input().split()]
    dc=Counter(D)
    dci=list(dc.items())
    dci.sort()
    mod,ans=998244353,1
    if D[0]!=0 or dci[0][1]!=1:
        print(0)
        sys.exit()

    for i,dcii in enumerate(dci):
        if i>1:
            ans*=dci[i-1][1]**dci[i][1]%mod
    print(ans%mod)

if __name__=='__main__':
    main()
# Judge status: Accepted
n,k=map(int,input().split())
h=[]
ma=10**9
for i in range(n):
  a=int(input())
  h.append(a)
h.sort()

for i in range(n-k+1):
  sa=h[k-1+i]-h[i]
  if sa<ma:
    ma=sa
    
print(ma)
# Judge status: Accepted
n=input()
c="Christmas"
e=" Eve"
if n=="22":
  print(c+e*3)
elif n=="23":
  print(c+e*2)
elif n=="24":
  print(c+e)
else:
  print(c)
# Judge status: Accepted
N = int(input())
A_list = list(map(int,input().split()))
A_set = set(A_list)

if len(A_list) == len(A_set):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
a, b = map(int, input().split())
ans = 0

for i in range(1270):
  x = i * 8
  y = x / 100
  z = i * 10
  q = z / 100
  if a == int(y) and b == int(q):
    if ans == 0:
      ans = i
    else:
      ans = min(ans, i)

if ans == 0:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
if x>=y:
    if x%y==0:
        print(-1)
        exit()
print(x)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a1=0
a2=0
a3=0
for i in a:
  if i%4==0:
    a1+=1
  elif i%4==2:
    a2+=1
  else:
    a3+=1
    
if a3==0:
  print("Yes")
else:
  if a2==0:
    if a1>=a3-1:
      print("Yes")
    else:
      print("No")
  else:
    if a1>=a3:
      print("Yes")
    else:
      print("No")
# Judge status: Wrong Answer
s=input()
t=input()
d=dict()
flag=True
for i in range(len(s)):
  if not(s[i] in d):
    d[s[i]]=t[i]
  else:
    if not(d[s[i]]==t[i]):
      flag=False
      break
    
ls=list(s)
if len(ls)==len(set(ls)):
  flag=True
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, x, t = map(int, input().split())
cnt = 0
time = 0
while True :
    if cnt >= n:
        break
    else:
        cnt += x
        time += t
print(time)
# Judge status: Accepted
f=lambda:[*map(int,input().split())]
n,x=f()
l=f()
d=[x-l[0]]
for i in range(n-1):
  d+=[l[i+1]-l[i]]
a=d[0]
from math import *
for i in d:
  a=gcd(a,i)
print(a)
# Judge status: Accepted
l, r, d = map(int, input().split())
ans = 0
for i in range(l, r+1):
    if i%d == 0:
        ans += 1
print(ans)
# Judge status: Wrong Answer
s = input()
n = len(s)
count = 0
if n % 2 == 0:
  t = n // 2
  for i in range(t):
    if s[i] != s[i+t]:
      count += 1
else:
  t = n // 2
  for i in range(t):
    if s[i] != s[i+t+1]:
      count += 1
print(count)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

tmp = True
ans = 0
for i in range(n):
    if i+1 == a[i]:
        if tmp == False:
            tmp = True
        else:
            ans += 1
            tmp = False
    else:
        tmp = True

print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    j = str(i)
    total = 0
    for k in j:
        total += int(k)
    if a <= total <= b:
        ans += i
print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
KA=[]
for i in range(N):
    KA.append(list(map(int,input().split())))
A=[]
a=0
for i in range(N):
    for j in range(1,len(KA[i])):
        A.append(KA[i][j])
if N==1:
    a+=len(A)
else:
    for i in range(M):
        if A.count(i)==N:
            a+=1
print(a)
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
import fractions
from functools import reduce

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
li = [ri() for _ in range(n)]
ans = 1
for i in li:
  a = fractions.gcd(i, ans)
  ans = ans * i // a
print(ans)
# Judge status: Wrong Answer
N , M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
sub = []
for i in range(M - 1):
	sub.append(X[i + 1] - X[i])
sub.sort()
print(sum(sub[:M - N]))
# Judge status: Accepted
s = input()
print(['A', 'a'][s.lower() == s])
# Judge status: Accepted
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

x, k, d = inpl()

t = abs(x) // d

if k <= t:
    print(abs(x)-k*d)
    sys.exit()

k -= t
if k % 2 == 1:
    print(d - abs(x) % d)
else:
    print(abs(x) % d)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)
# Judge status: Accepted
S = input()
tf = []
for s in S:
    if s in "ACGT":
        tf.append(True)
    else:
        tf.append(False)

ans = 0
temp = 0
for res in tf:
    if res:
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)
# Judge status: Accepted
N = int(input())
D = list(map(int, input().split()))
mod = 998244353
counter = [0] * N
for d in D:
    counter[d] += 1

if counter[0] != 1:
    print(0)
    exit()

ans = 1
for d in D[1:]:
    ans = ans * counter[d-1] % mod
print(ans)
# Judge status: Wrong Answer
s=input()
c=0
d=0
t=len(s)
if t%2==0:
  for i in range(int(t/2)):
    if s[i]!=s[t-i-1]:
      c+=1
  print(c)
else:
  for _ in range(int((t-1)/2-1)):
    if s[_]!=s[t-2-_]:
      d+=1
    print(d)
# Judge status: Accepted
a1 = input()
a2 = input()
if a1[0] == a2[2] and a1[1] == a2[1] and a1[2] == a2[0]:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
color = []
free = 0
for x in a:
    if x < 400:color.append("g")
    elif x < 800:color.append("b")
    elif x < 1200:color.append("gr")
    elif x < 1600:color.append("bl1")
    elif x < 2000:color.append("bl2")
    elif x < 2400:color.append("y")
    elif x < 2800:color.append("o")
    elif x < 3200:color.append("r")
    else: free += 1
color = list(set(color))
ans = len(color)
if ans == 0 and free > 0: ans = 1
print(ans, ans + free)
# Judge status: Wrong Answer
a,b,c,d = map(int,input('').split(' '))

print(b*d)
# Judge status: Accepted
A, B = map(int,input().split())
if A<=8 and B<=8:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
n = int(input())

for i in range(n+1):
    if int(i * 1.08) == n:
        print(i)
        exit()
print(":(")
# Judge status: Accepted
def main():
    N = input()
    if N[-1] == "2" or N[-1] == "4" or N[-1] == "5" or N[-1] == "7" or N[-1] == "9":
        print("hon")
    elif N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8":
        print("pon")
    elif N[-1] == "3":
        print("bon")
if __name__ == "__main__":
    main()
# Judge status: Accepted
A,B,C,X = [int(input()) for i in range(4)]
count = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      x = 500*a + 100*b + 50*c
      if X == x:
        count += 1
 
print(count)
# Judge status: Accepted
r,g,b = input().split()

a = r + g + b

if int(a) % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

ans = b-a

if abs(ans)>10**18:
    print('Unfair')
else:
    print(ans)
# Judge status: Accepted
w = list(input())

keys = list(set(w))
cnt = 0
for k in keys:
    kl = len([x for x in w if x == k])
    if kl % 2 != 0:
        cnt += 1

print("Yes" if cnt == 0 else "No")
# Judge status: Wrong Answer
n = int(input());A = [] ; s = 0 ; t = 0

for i in range(1,n+1):
    for j in range(len(str(i))):
        s += int(str(i)[j])
    for k in range(len(str(n-i))):
        t += int(str(n-i)[k])
    a = s + t
    A.append(a)
    s = 0 ; t = 0
    
print(min(A))
# Judge status: Wrong Answer
import math
N = int(input())
A = sorted(list(map(int, input().split())))
ans = 0
for i in range(N - 1):
    ans += A[N - math.ceil(i / 2) - 1]
    print(ans)
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))


def ceil(x, y):
    if x % y == 0:
        return x // y
    else:
        return x // y + 1


print(ceil(n-1, k-1))
# Judge status: Wrong Answer
n,k=map(int,input().split())
while n>=0:
  n=abs(n-k)
  if n-k<=0:
    print(abs(n-1))
    break
# Judge status: Wrong Answer
import collections
s = list(input())
c = collections.Counter(s)
p = list(c.items())
p.sort()
i=0
for k,v in p:
    if k == chr(ord("a")+i):
        i += 1
    else:
        print(chr(ord("a")+i))
        exit()
print("None")
# Judge status: Accepted
S = input()

if (S[0] == S[1]) or (S[1] == S[2]) or (S[2] == S[3]):
    print ('Bad')
else:
    print ('Good')
# Judge status: Accepted
N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        min_= 1
        continue
    if (int(min_) < int(L[i])):
        suc -= 1
        continue
    if (int(min_) >= int(L[i])):
        min_ = L[i]
print(suc)
# Judge status: Accepted
N, X, Y = map(int, input().split())
K = [0]*(N-1)
for i in range(1,N+1):
	for j in range(i+1,N+1):
		K[min(min(abs(X-i)+1,abs(Y-i))+abs(j-Y),abs(i-j))-1]+=1
for i in range(N-1):
	print(K[i])
# Judge status: Wrong Answer
k,n=map(int,input().split())
a=list(map(int,input().split()))
b=a
for i in range(1,n):
    a[i]-=b[i-1]
print(k-max(a))
# Judge status: Accepted
from bisect import bisect_right

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

bc=[0]*N
bcsum=[0]*N

for i in range(N):
    b=B[i]
    bc[i]=N-bisect_right(C,b)

bcsum[0]=sum(bc)

for i in range(1,N):
    bcsum[i]=bcsum[i-1]-bc[i-1]
ans=0
for a in A:
    p=bisect_right(B,a)
    if p<N:
        ans+=bcsum[p]

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

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

if((a**2)*b/2 > x):
    print(degrees(atan(a*b**2/(2*x))))
else:
    print(degrees(atan( (2*(a**2 * b - x) / a**3))))
# Judge status: Accepted
n = int(input())
n -= 1
a = 0
dig = 1
while a + 26**dig <= n:
    a += 26**dig
    dig += 1
n -= a
ans = []
for i in range(dig):
    ans += [chr(n % 26 + 97)]
    n //= 26
print(''.join(reversed(ans)))
# Judge status: Wrong Answer
K = int(input())
mod = 0
# mod Kは、0,1,...,K-1　の高々K種類
# i=K+1 まで行くと鳩の巣原理よりmodが既出になり、以降ループ
# すなわちi=Kまで見れば十分
for i in range(1, K + 1):
    mod = (10 * mod + 7) % K
    if mod % K == 0:
        print(i)
        exit()
# Judge status: Accepted
from math import gcd

k = int(input())


ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(gcd(a, b), c)

print(ans)
# Judge status: Wrong Answer
s, w = map(int, input().split())
if s / 2 <= w:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
a, b, k = map(int, input().split())
l = []
for i in range(a, min(a + k, b)):
    l.append(i)

for i in range(max(a, b - k + 1), b + 1):
    l.append(i)

for i in sorted(set(l)):
    print(i)
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!

A, B, C, K =  map(int, input().split())
ans = 0

if A + B >= K:
    ans = A
else:
    ans = A - (K - C)
print(ans)
# Judge status: Accepted
n = int(input())
h_list = list(map(int, input().split()))

cost_list = [0] * len(h_list)

cost_list[0] = 0
cost_list[1] = abs(h_list[1] - h_list[0])

for i in range(2, n):
    cost_list[i] = min(abs(h_list[i-1] - h_list[i]) + cost_list[i-1],
                       abs(h_list[i-2] - h_list[i]) + cost_list[i-2])

print(cost_list[-1])
# Judge status: Accepted
from sys import stdin

N = int(stdin.readline().rstrip())
X_list = []
L_list = []
#left_pos = []
#right_pos = []
range_pos = []
for i in range(N):
    [X, L] = [int(x) for x in stdin.readline().rstrip().split()]
    X_list.append(X)
    L_list.append(L)
    range_pos.append([X+L, X-L])

range_pos.sort()

index  = 0
prev_right = -1e8
for i in range(N):
    if prev_right <= range_pos[i][1]:
        prev_right = range_pos[i][0]
        index+=1

print(index)
# Judge status: Accepted
print('YNeos'[input()[-1]in'29'::2])
# Judge status: Accepted
x,y=map(int,input().split())
ans=1
while 2*x<=y:
    x=2*x
    ans+=1
print(ans)
# Judge status: Accepted
import sys
n=int(input())
a=list(map(int,input().split()))
ans=0
m=sum(a)
leaf=1
for i in range(n+1):
    ans+=leaf
    leaf=leaf-a[i]
    m-=a[i]

    if leaf<0 or (leaf==0 and m>0):
        print(-1)
        sys.exit()

    tmp=leaf
    for j in range(min(n-i,60)):
        tmp*=2
        if tmp>=m: break
    if tmp<m:
        print(-1)
        sys.exit()        

    if leaf*2>=m: leaf=m
    else: leaf*=2

print(ans)
# Judge status: Accepted
from itertools import permutations
n = int(input())
s = sorted([int(input()) for _ in range(n)])
ans = sum(s)
if ans % 10:
    print(ans)
else:
    m = ans
    for i in range(n):
        if s[i] % 10:
            m = s[i]
            break
    print(ans - m)
# Judge status: Accepted
def main():
    n = int(input())
    ans = set()
    for _ in range(n):
        a = int(input())
        if a in ans:
            ans.discard(a)
        else:
            ans.add(a)

    print(len(ans))


if __name__ == "__main__":
    main()
# Judge status: Accepted
A,B,K=list(map(int,input().split()))
gcd=[]
C=min(A,B)
for i in range(1,C+1):
  if A%i==0 and B%i==0:
    gcd.append(i)
print(gcd[-K])
# Judge status: Accepted
S = input()
answer = 1000000
for i in range(len(S) - 2):
    answer = min(abs(753 - int(S[i:i + 3])), answer)
print(answer)
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
ans=0
battle=[0]*n
for i in range(n):
	if i>=k:
		if t[i]==t[i-k] and battle[i-k]==1:
			continue
		else:
			battle[i]=1
			if t[i]=="r":
				ans+=p
			elif t[i]=="s":
				ans+=r
			else:
				ans+=s
	else:
		battle[i]=1
		if t[i]=="r":
			ans+=p
		elif t[i]=="s":
			ans+=r
		else:
			ans+=s
print(ans)
# Judge status: Accepted
c=input()
chr="abcdefghijklmnopqrstuvwxyz"
for i in range(len(chr)):
    if c==chr[i]:
        print(chr[i+1])
# Judge status: Accepted
import fractions
from functools import reduce

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
L = []
for i in range(N):
  L.append(abs(X-x[i]))

def gcd(*numbers):
  return reduce(fractions.gcd,numbers)

print(gcd(*L))
# Judge status: Accepted
import sys


def solve(inp):
    (N, M) = map(int, inp.readline().split(' '))
    AB = [list(map(int, inp.readline().split(' '))) for i in range(M)]

    roads = [0 for i in range(N)]
    for ab in AB:
        roads[ab[0] - 1] += 1
        roads[ab[1] - 1] += 1

    for i in range(N):
        print(roads[i])

    return ""


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())
if (x%11) == 0:
    print((x//11)*2)
elif (x%11) <= 6:
    print((x//11)+(x//11)+1)
elif (x%11) > 6:
    print((x//11)+(x//11)+2)
# Judge status: Accepted
X = int(input())
m = 1
for b in range(2, X):
    p = 2
    while b ** p <= X:
        m = max(b ** p, m)
        p += 1
print(m)
# Judge status: Wrong Answer
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return a*b // gcd(a,b)

a,b,c,d = map(int,input().split())
A = a-((a//c) + (a//d) - a//lcm(c,d))
B = b-((b//c) + (b//d) - b//lcm(c,d))
print(B-A)
# Judge status: Accepted
S = input()
if S[0] != S[1] and S[1] != S[2] and S[2] != S[3]:
    print("Good")
else:
    print("Bad")
# Judge status: Accepted
H = int(input())
h = H
d = [0]
while h > 0:
    d.append(h)
    h = h//2
d.sort()
attack = {}
attack[0] = 0
for i in range(1,len(d)):
    attack[d[i]] = 2*attack[d[i-1]] + 1
print(attack[H])
# Judge status: Wrong Answer
s = input()
ans = 0
carry = 0
for v in s:
    i = int(v) + carry
    if i <= 5:
        ans += i
        carry = 0
    else:
        ans += (10 - i)
        carry = 1
ans += carry
# Judge status: Accepted
n=int(input())

dic={}
for i in range(n):
  s=input()
  if s not in dic:
    dic[s]=1
  else:
    dic[s]+=1


dic = sorted(dic.items(),key=lambda x:x[0])
dic = sorted(dic,key=lambda x:x[1],reverse=True)

ma=dic[0][1]
for i,v in dic:
  if v!=ma:
    break
  else:
    print(i)
# Judge status: Wrong Answer
s = int(input())
mod = 10**9+7
import numpy as np

if s == 1 or s == 2:
  print(0)
elif s == 3 or s == 4:
  print(1)
else:
  array = np.zeros(s)
  array[2] = 1
  array[3] = 1
  for i in range(4, s):
    array[i] = (array[i-1] + array[i-3]) % mod
  print(array[s-1])
# Judge status: Accepted

def resolve():
    c = input()
    print("vowel" if c in ["a", "i", "u", "e", "o"] else "consonant")


if '__main__' == __name__:
    resolve()
# Judge status: Accepted
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n, T = map(int, input().split())
cost = False
for i in range(n):
    c, t = map(int, input().split())
    if t > T:
        pass
    else:
        if cost == False:
            cost = c
        else:
            if cost > c:
                cost = c
if cost == False:
    print("TLE")
else:
    print(cost)
# Judge status: Accepted
A,B = map(int, input().split())
if (A+B)%2 == 0:
  print((A+B)//2)
else:
  print('IMPOSSIBLE')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

res = 0
for i in range(N):
    A[i] = abs(A[i]-(i+1))
b = A[N//2]
print(sum(list(map(lambda x:abs(x-b),A))))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))+[0]
ans=0
for i in range(n):
  if a[i]>=b[i]:
    ans+=b[i]
  else:
    b[i+1]+=b[i]-a[i]
    ans+=a[i]
if a[n]>=b[n]:
  ans+=b[n]
else:
  ans+=a[n]
print(ans)
# Judge status: Accepted
from collections import Counter
w=list(str(input()))

mylist=Counter(w)
for a in mylist.values():
  if a%2==0:
    continue
  else:
    print('No')
    exit()
print('Yes')
# Judge status: Accepted
from collections import Counter

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

C = Counter(A)
C = sorted(C.items(), key=lambda x:x[1])

if len(C) <= K:
  print(0)
else:
  print(sum([c[1] for c in C[:len(C)-K]]))
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  s = input().strip()
  print({'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}[s])

if __name__=='__main__':
  main()
# Judge status: Accepted
S=input()
A=S.replace("eraser","").replace("erase","").replace("dreamer","dream").replace("dream","")
if A=="":
	print("YES")
else:
	print("NO")
# Judge status: Wrong Answer
K = int(input())
if K%2 == 0:
    print((K//2)**2)
else:
    print((K//2)*(K+1//2))
# Judge status: Wrong Answer
import math
n=int(input())
m=math.ceil(math.sqrt(n))
list=[]

for i in range(1,m):
  if n%i==0:
    s=n//i
    t=s+i
    list.append(t)
list.sort()
print(list[0]-2)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

q,h,s,d=map(int,input().split())
n=int(input())
s=min(q*4,h*2,s)
if s*2<d:
    print(s*n)
else:
    if n%2:
        print(d*(n//2)+s)
    else:
        print(d*(n//2))
# Judge status: Accepted
import math
def primecheck(x):

    for i in range(2,math.ceil(x*(1/2))):
        if x % i == 0:
            return False
            break 
    return True



x = int(input())
for i in range(x,10**6):
    if primecheck(i):
        break
print(i)
# Judge status: Accepted
n = int(input())
lst = list(map(int, input().split()))
s = sum(lst)
q = int(input())
dic = {}
for i in range(n):
  dic.setdefault(lst[i], 0)
  dic[lst[i]] += 1
for i in range(q):
  b, c = map(int, input().split())
  dic.setdefault(b, 0)
  dic.setdefault(c, 0)
  dic[c] += dic[b]
  s += ((c - b) * dic[b])
  print(s)
  dic[b] = 0