peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
ans = 0
exist = False
if N == 1:
  x = 0
else:
  x = 10 ** (N - 1)
for i in range(x, 1000):
  s = str(i)
  f = True
  for j in range(M):
    if int(s[sc[j][0] - 1]) != sc[j][1]:
      f = False
      break
  if f:
    ans = i
    exist = True
    break
print(ans if exist else -1)
# Judge status: Accepted
n, h = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

a = sorted(a, reverse=True)
b = sorted(b, reverse=True)

ans = 0
i = 0
while i < n and b[i] > a[0]:
    h -= b[i]
    ans += 1
    if h <= 0:
        print(ans)
        exit()
    i += 1

print(ans + (h + a[0] - 1) // a[0])
# Judge status: Wrong Answer
a, b, t = open(0)
n, k = map(int, a.split())
r, s, p = map(int, b.split())
d = {"r": p, "s": r, "p": s}
l = [0]*n
for i, s in enumerate(list(t.strip())):
  c = d[s]
  if i-k >= 0 and l[i-k] == c:
    continue
  l[i] = c
print(sum(l))
# Judge status: Wrong Answer

N=int(input())
A=sorted([int(input()) for _ in range(N)])
B=A[:N-1]
for i in range(N):
    if  i==N-1:
        print(max(B))
    else:
        print(max(A))
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int,input().split()))

i = 0

while i+K<N:
  if A[i]<A[K+i]:
    print('Yes')
    i += 1
  else:
    print('No')
    i += 1
# Judge status: Wrong Answer
import math
N = int(input())
A = [int(x) for x in input().split()]
s = sum(A)
ave = s / N
if s % 2 == 0:
    ave = s // N
    ans = [(x - ave)**2 for x in A]
    ans = sum(ans)
    print(ans)
    exit()
else:
    ave1, ave2 = math.ceil(s / N), math.floor(s / N)
    ans1 = [(x - ave1)**2 for x in A]
    ans2 = [(x - ave2)**2 for x in A]
    ans = min(sum(ans1), sum(ans2))
    print(ans)
# Judge status: Wrong Answer
def main():
    x,n = map(int,input().split())
    p = list(map(int,input().split()))
    ans = -100
    for i in range(-1,101):
        if i not in p and abs(i-x) < abs(ans-x):
            ans = i
    print(ans)
    
    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]

cnt = 1
br = 0

for i in a:
    if i == cnt:
        cnt += 1
    else:
        br += 1

if br == n:
    br = -1

print(br)
# Judge status: Accepted
a,b,c,d = input()

for x in '+-':
    for y in '+-':
        for z in '+-':
            f = a + x + b + y + c + z + d
            if eval(f) == 7:
                print(f + '=7')
                exit()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
up_or_down = 0
ans = 1
for i in range(len(A) - 1):
    if up_or_down == 0:
        up_or_down = A[i+1] - A[i]
    else:
        if up_or_down > 0 and A[i+1] - A[i] < 0:
            ans += 1
            up_or_down = 0
        elif up_or_down < 0 and A[i+1] - A[i] > 0:
            ans += 1
            up_or_down = 0
print(ans)
# Judge status: Accepted
S = input()
M = 2019

cnt = [0] * M
cnt[0] = 1
N = 0
ans = 0
for i, n in enumerate(map(int, S[::-1])):
    N = (N + n * pow(10, i, M)) % M
    ans += cnt[N]
    cnt[N] += 1
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')
# Judge status: Wrong Answer
l=int(input())
ans=0
for i in range(0,l+1):
    for j in range(0,l+1):
        e=l-i-j
        ans=max(i*j*e,ans)
print(ans)
# Judge status: Accepted
[N, K, S] = [int(i) for i in input().split()]

ans = [str(S)]*N

if S != 10**9:
    for i in range(K, N):
        ans[i] = str(S+1)
else:
    for i in range(K, N):
        ans[i] = str(1)
    
print(' '.join(ans))
# Judge status: Accepted
from heapq import heappush, heappop, heapify

x,y,a,b,c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)

R = p[:x]
B = q[:y]

heapify(R)
heapify(B)
for i in range(c):
  if min(R[0],B[0]) > r[i]:
    break
  if R[0] < B[0]:
    heappop(R)
    heappush(R,r[i])
  else:
    heappop(B)
    heappush(B,r[i])

print(sum(R) + sum(B))
# Judge status: Accepted
#coding:utf-8
h = int(input())
w = int(input())
n = int(input())
#切り上げ
if h >= w:
    print(-(-n//h))
else:
    print(-(-n//w))
# Judge status: Wrong Answer
from itertools import permutations

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
a, b = 0, 0

for i, l in enumerate(permutations(range(1, N+1))):
    if l==P: 
        a = i
    elif l==Q:
        b = i

print(abs(a-b))
# Judge status: Accepted
s = list(input())
k = int(input())
for i in range(len(s)):
  if s[i] != "1":
    break
if k-1 < i:
  print("1")
else:
  print(s[i])
# Judge status: Accepted
m=lambda:map(int,input().split())
a,b,c=m();d,e,f=m();g,h,i=m()
print(['No','Yes'][d-a==e-b==f-c and g-a==h-b==i-c])
# Judge status: Accepted
a,b,c=list(map(int ,input().split()))
ans_range=range(a,b)
ans_range1=range(b,a)
if(c in ans_range or c in ans_range1):
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
#!/usr/bin/env python3
n = int(input())
s = [int(input()) for _ in range(n)]
s_5 = [s[i] for i in range(n) if s[i] % 10 == 5]
# maxはsumから5の倍数ならそのまま、10の倍数ならminの5の倍数をひく
sum_s = sum(s)
s_5.sort()
if sum_s % 10 == 5:
    print(sum_s)
else:
    if len(s_5) == 0:
        print(0)
    else: print(sum_s - s_5[0])
# Judge status: Wrong Answer
a = list(map(int,input().split()))
hanbun = int(sum(a)/2)
isOK = False
for i in range(3):
    if hanbun==a[i]:
        isOK = True
if isOK:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
print(int(h*(a+b)/2))
# Judge status: Wrong Answer
a,b,x = map(int, input().split())
if a//x==a/x:
    A=a//x
else:
    A=a//x+1
B=b//x

print(0 if B-A==0  else B-A+1)
# Judge status: Accepted
a, b = map(int, input().split())
x = a + b
if x % 2 == 0:
    print(x // 2)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input())
robots, count = [], 0
for x in range(N):
    X, L = map(int, input().split())
    robots.append((X+L, X-L))
robots.sort()
node = -10**12
for end, start in robots:
    if start >= node:
        node = end
        count += 1
print(count)
# Judge status: Accepted
from math import ceil

n = int(input())
cs = []
ss = []
fs = []

for _ in range(n-1):
    c, s, f = map(int, input().split())
    cs.append(c)
    ss.append(s)
    fs.append(f)

for i in range(n):
    t = 0
    for j in range(i, n-1):
        if t < ss[j]:
            t = ss[j]
        t = ceil(t / fs[j]) * fs[j]
        t += cs[j]
    print(t)
# Judge status: Wrong Answer
n,w=[int(i) for i in input().split()]
wi=[]
val=[]
for i in range(n):
    k=[int(i) for i in input().split()]
    wi.append(k[0])
    val.append(k[1])
dp=[[-1]*10**5]*105
def solve(pos,we):
    if we>w:
        return float("-inf")
    if pos>=n:
        return 0
    if dp[pos][we]!=-1:
        return dp[pos][we]
    ans=max(solve(pos+1,we+wi[pos])+val[pos],solve(pos+1,we))
    dp[pos][we]=ans
    return ans
print(solve(0,0))
# Judge status: Accepted
from heapq import *

N,*A = map(int, open(0).read().split())
ai = [x * (-1) for x in A]
heapify(ai)
ans = heappop(ai) * (-1)
searching = 1
for i in range(N-2):
    if i % 2 == 0:
        temp = heappop(ai) * (-1)
    ans += temp
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
def solve(a):
    for i in range(len(a)-1):
        if a[i+1] - a[i] <= -2:
            return "No"
        elif a[i+1] - a[i] == -1:
            a[i+1] += 1
    return "Yes"

def main():
    N = int(input())
    A = [0] + list(map(int,input().split()))
    print(solve(A))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a>0:
    print('Positive')
elif b<0:
    print('Negative')
else:
    print('Zero')
# Judge status: Wrong Answer
N = int(input())
d = [int(i) for i in input().split()]
l = len(d) // 2
boundary = d[l - 1]
next_d = boundary
for i in d[l:]:
    if i > boundary:
        next_d = i
        break
print(next_d - boundary)
# Judge status: Wrong Answer
n = int(input())
a = []
ans = 1

for i in range(5):
    a.append(int(input()))
    
for i in a:
    if n>i:
        if n%i == 0:
            ans += n//i
        else:
            ans += n//i+1
        n = n%i
    else:
        ans += 1
        
print(ans)
# Judge status: Wrong Answer
a = int(input())
if a == 3 | a == 5 | a == 7:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
s = sorted(input())
t = sorted(input())
flag1 = True
flag2 = False
if len(s) < len(t):
    for i in range(len(s)):
        if s[i] != t[i]:
            flag1 = False
            break
else:
    flag1 = False
for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        flag2 = True
        break
if flag1 or flag2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
cnt = 0
for i in range(n):
    if A[i] > B[i]:
        cnt -= (A[i] - B[i])
    else:
        cnt += (B[i] - A[i])//2
print('Yes' if cnt > 0 else 'No')
# Judge status: Wrong Answer
N = int(input())
K = N % 2
S = (N + K) / 2 
print(S)
# Judge status: Accepted
import sys
input = sys.stdin.readline
from itertools import accumulate

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

for tests in range(K):
    B=[0]*(N+1)
    for i in range(N):
        B[max(0,i-A[i])]+=1
        B[min(N,i+A[i]+1)]-=1

    A=list(accumulate(B))
    flag=1
    for i in range(N):
        if A[i]<N:
            flag=0
        A[i]=min(A[i],N)

    if flag:
        break
    #print(A)

print(*A[:N])
# Judge status: Accepted
def solve(s):
    return "Yes" if "hi" * (len(s) // 2) == s else "No"

assert solve("hihi") == "Yes"
assert solve("hi") == "Yes"
assert solve("ha") == "No"
assert solve("hii") == "No"

s = input()
print(solve(s))
# Judge status: Accepted
n,k = map(int,input().split())
if n % k > -(n % k - k):
    print(-(n % k - k))
else:
    print(n % k)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
most = max(L)
if 2*most < sum(L):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

cnt = 0

for i in range(1, n-1):
    if(p[i-1] < p[i] and p[i] < p[i+1]):
        cnt += 1
    elif(p[i-1] > p[i] and p[i] > p[i+1]):
        cnt += 1
print(cnt)
# Judge status: Accepted
import itertools
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

li = list(itertools.permutations(range(1, n+1), n))
a = li.index(p)
b = li.index(q)
print(abs(a-b))
# Judge status: Accepted
N, M = map(int, input().split()) 
left = 1
right = N
for _ in range(M):
    L, R = map(int, input().split())
    left = max(left, L)
    right = min(right, R)
if left > right:
    print(0)
else:
    print(right - left + 1)
# Judge status: Wrong Answer
import numpy as np

h, n = map(int, input().split())
ab = np.array([list(map(int, input().split()))])

a, b = ab[:, 0], ab[:, 1]
dp = np.zeros(h+1, dtype=np.int)
for i in range(1, h+1):
    dp[i] = np.min(dp[np.maximum(i-a, 0)] + b)

print(dp[h])
# Judge status: Wrong Answer
a,b = map(int,input().split())
div = int(10e9+7)

if abs(a-b)>1:
    print(0)
else:
    if a != b:
        x = 1
        y = 1
        for i in range(2,a+1):
            x *= i
            x %= div
        for i in range(2,b+1):
            y *= i
            y %= div
        print(x*y%div)
    else:
        print(a*b*2%div)
# Judge status: Wrong Answer
e = int(input())
print(int(e/15))
print(e*800 - (int(e/15)*200))
# Judge status: Accepted
S = input()
T = input()

ans = len(T)

for S_start in range(len(S) - len(T) + 1):
    correct = 0
    for i in range(len(T)):
        if T[i] != S[S_start + i]:
            correct += 1
    ans = min(ans, correct)
    #print(ans)

print(ans)
# Judge status: Accepted
s = input()

st = None
en = None
for i in range(len(s)):
    if st is None and s[i] == 'A':
        st = i
    if en is None and s[-i-1] == 'Z':
        en = -i - 1
print(len(s[st:en]) + 1)
# Judge status: Accepted
def main():
    n, *a = map(int, open(0).read().split())

    c = 1
    f = 0
    d = [-1,1]
    for i, j in zip(a, a[1:]):
      if i == j:
        continue
      else:
        g = d[i < j]
        if f * g == -1:
          f = 0
          c += 1
        else:
          f = g
    
    print(c)


if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C = (int(x) for x in input().split())

ans = B+C-A
if ans>=0:
    print(ans)
else:
    print(0)
# Judge status: Accepted
N, T = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans, sav = 1001, 0
for i in A:
    if i[1] <= T:
        sav = i[0]
        if ans > sav:
            ans = sav
if ans > 1000:
    ans = "TLE"
print(ans)
# Judge status: Accepted
s = input()

print(s[0]+s[1]+s[2])
# Judge status: Accepted
import sys
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    counter = Counter(A)
    M = len(counter.keys())
    value = sorted(counter.values())

    ans = 0
    for i in range(M - K):
        ans += value[i]

    print(ans)

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C= map(int,input().split())
if A == B == C :
    print('No')
elif A == B :
    print('Yes')
elif B == C :
    print('Yes')
elif A == C :
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
for i in reversed(range(1,n)):
    if sum(ans[(i-i)::i])%2 != a[i]:
        ans[i] += 1
if sum(ans) != a[0]:
    ans[0] += 1
print(" ".join(map(str, ans)))
# Judge status: Accepted
n = int(input())
x = list(map(int,input().split()))
a = min(x)
b = max(x) + 1
ans = 10 ** 8
for p in range(a,b):
    m = 0
    for i in range(n):
        m += (x[i] - p) ** 2
    ans = min(ans,m)
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

if x in g1 and y in g1:
    print("Yes")
elif x in g2 and y in g2:
    print("Yes")
elif x in g3 and y in g3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from math import sqrt

n, d = map(int, input().split())

cnt = 0
for i in range(n):
    x, y = map(int, input().split())
    if sqrt(x ** 2 + y ** 2) <= d:
        cnt += 1

print(cnt)
# Judge status: Accepted
n=int(input())
s=input()

from collections import Counter

ans = s.count("R") * s.count("G") * s.count("B")

for step in range(1,n//2+2):
    for start in range(n):
#         print(start,step,start+2*step,n)
        if start+2*step>=n:
#             print("out!")
            break
        ans-=len(set((s[start], s[start+step],s[start+2*step])))==3
print(ans)
# Judge status: Wrong Answer
A, B, T = map(int, input().split(' '))

print(B * T // A)
# Judge status: Accepted
import sys
readline = sys.stdin.readline

def main():
    n = int(readline())
    w1 = readline().rstrip()
    l = w1[-1]
    words = set()
    words.add(w1)
    for _ in range(n-1):
        w = readline().rstrip()
        if w[0] == l and w not in words:
            l = w[-1]
            words.add(w)
        else:
            print('No')
            return
    
    print('Yes')


if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import Counter

N = int(input())
S = list(input())

ans = 1
for v in Counter(S).values():
    ans *= v+1
print((ans-1)%1000000007)
# Judge status: Accepted
n, k = list(map(int, input().split()))
s=input()

before = s[0:k-1]
low = s[k-1]
low = low.lower()
after = s[k:]

print(before+low+after)
# Judge status: Accepted
import math
A, B, C, D = map(int, input().split())
# 対象となる数の個数
num = B - A + 1
# Cで割り切れる数の個数
C_div = B // C - (A - 1) // C
# Dで割り切れる数の個数
D_div = B // D - (A - 1) // D
# CでもDでも割り切れる数の個数
CandD =  (C * D) // math.gcd(C, D)
CandD_div = B // CandD - (A - 1) // CandD
# CもしくはDで割り切れる数の個数
CorD_div = C_div + D_div - CandD_div
res = num - CorD_div
print(res)
# Judge status: Accepted
n = int(input())
s = input()
(r,g,b) = (0,0,0)
for i in s:
	if i == "R":
		r += 1
	elif i == "G":
		g += 1
	else:
		b += 1
a = r*g*b
t = 0
for i in range(n-2):
	for j in range(i+1,n-1):
		if 2*j-i <= n-1 and s[i]!=s[j] and s[j]!=s[2*j-i] and s[2*j-i]!=s[i]:
			t += 1
print (a-t)
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

abcde = list(map(int, read().split()))
check = sorted([abcde[0] % 10, abcde[1] % 10, abcde[2] % 10, abcde[3] % 10, abcde[4] % 10])
for i in range(5):
    if check[0] == 0:
        check.pop(0)
    else:
        break
if not check:
    check = [0]
ans = 0
for v in abcde:
    if v % 10 == check[0] or v % 10 == 0:
        ans += v
    else:
        ans += (v - v % 10) + 10
print(ans)
# Judge status: Accepted
import numpy as np
N,M=map(int,input().split())
wa=np.zeros(N+1)
ac=np.zeros(N+1)
for _ in range(M):
    p,S=input().split()
    if S=='AC' and ac[int(p)]==0:
        ac[int(p)]+=1
    elif S=='AC' and ac[int(p)]>0:
        pass
    elif ac[int(p)]==0:
        wa[int(p)]+=1
print(int(sum(ac)), int(np.dot(ac>0,wa)))
# Judge status: Wrong Answer
n = input()
p = list(map(int,input().split()))

ps = sorted(p)

d_p = []
d_ps = []
for i,q in enumerate(p):
  if q != ps[i]:
    d_p.append(q)
    d_ps.append(ps[i])
if len(d_p) > 2:
  print('No')
elif len(d_p) == 2:
  d_p.sort()
  if d_p == d_ps:
    print('Yes')
  else:
    print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
money = 1000
kabu = 0
for i in range(n-1):
    if a[i] < a[i+1]:
        kabu += money // a[i]
        money -= a[i] * kabu
    elif a[i] > a[i+1]:
        money += a[i] * kabu
        kabu = 0
print(money + a[-1] * kabu)
# Judge status: Accepted
N, K = map(int, input().split())

MOD = 10**9 + 7
def f(t):
  return (N-t+1)*t+1

ans = 0
for i in range(K, N+2):
  ans += f(i)
  ans %= MOD
print(ans)
# Judge status: Accepted
age = int(input())
if age == 3 or age == 5 or age == 7:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
r = []
for i in range(n):
    s, p = input().split()
    r.append((i + 1, s, int(p)))
r.sort(key=lambda x: (x[1], -x[2]))
for ri in r:
    print(ri[0])
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

for i in range(K):
    a = A
    b = B
    c = C

    A = b + c
    B = a + c
    C = a + b

ans = A - B

if ans >= 10**8:
    ans = 'Unfair'
elif ans >*10**8:
    ans = 'Unfair'

print(ans)
'''



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

if K%2==1: 
    ans = B - A
else:
    ans = A - B

if ans >= 10**18 or (-1)*ans >= 10**18:
    ans = 'Unfair'

print(ans)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<k:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))

cnt=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        p=bisect.bisect_right(l,l[i]+l[j]-1)
print(cnt)
# Judge status: Accepted
A,B,N = map(int,input().split())

if B<=N:
    print(int((A*(B-1))/B)-(A*int((B-1)/B)))
else:
    print(int((A*N)/B)-(A*int(N/B)))
# Judge status: Accepted
h,a = map(int,input().split())	
li = list(map(int,input().split()))

if sum(li)>=h:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
num = int(input())
result = 0
for fizzbuzz in range(num):
    if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
        continue
    elif fizzbuzz % 3 == 0:
        continue
    elif fizzbuzz % 5 == 0:
        continue
    result += fizzbuzz

print(result)
# Judge status: Wrong Answer
N, M = map(int, input().split())
while N * 2 <= M:
    M -= 2
    N += 1
print(N - 1)
# Judge status: Accepted
n=int(input())

ans=1
while (ans+1)**2<=n:
    ans+=1
print(ans**2)
# Judge status: Accepted
from sys import stdin
lines = stdin.readlines()
 
H, A = map(int, lines[0].split())

cnt = 1
while cnt <= 10000:
  if cnt * A >= H:
    print(cnt)
    break
  cnt += 1
# Judge status: Accepted
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [-1]*(n+1)
memo[0] = 0

for k in range(m):
    memo[a[k]] = 0

for i in range(1, n+1):
    if memo[i] != -1:
        pass 
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))

a.sort(reverse=True)
ideal = a[0]//2
dif_mn = 10**9

for i in range(1,n):
    tmp = a[0]-a[i] if a[i] > ideal else a[i]
    dif = ideal-tmp
    if dif < dif_mn:
        r = a[i]
        dif_mn = dif

print(a[0], r)
# Judge status: Accepted
s=input()
c=0
s2=""
s3=""
for i in s:
 s3+=i
 if s2!=s3:
  c+=1
  s2=s3
  s3=""
print(c)
# Judge status: Accepted
import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

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

MODp = 1000000007
K = 1
for i in range(N):
  K = lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K // l[i]))

Ans = Ans % MODp
print(Ans)
# Judge status: Wrong Answer
X, K, D = map(int, input().split())

if abs(X) < K * D:
    t1 = X % D
    t2 = D - t1
    print(min(t1, t2))

else:
    t1 = abs(abs(X) - K * D)
    t2 = abs(abs(X) - (K - 1) * D)
    print(min(t1, t2))
# Judge status: Accepted
L=[int(input()) for _ in range(6)];print(["Yay!",":("][L[4]-L[0]>L[5]])
# Judge status: Wrong Answer
n,x,t=map(int,input().split())
print((int(n/x)+1)*t)
# Judge status: Accepted
n,a,b = map(int, input().split())

res = 0

for i in range(1, n+1):
  tot = i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000
  if tot >= a and tot <= b:
    res += i

print(res)
# Judge status: Wrong Answer
N = list(input())

N[0] = "2"
N[1] = "0"
N[2] = "1"
N[3] = "8"

print(N)
date = ''.join(N)
print(date)
# Judge status: Accepted
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
n,k=NM()
l=L()
dp=[]
from itertools import accumulate
for _ in range(min(100,k)):
    tl,l=l,[0]*(n+1)
    for i,j in enumerate(tl):
        l[max(0,i-j)]+=1
        l[min(n,i+j+1)]-=1
    l=list(accumulate(l))
print(" ".join(map(str,l[:n])))
# Judge status: Wrong Answer
N=int(input())
h=list(map(int, input().split()))
cnt=0
ans=0

for i in range(N-1):
    if h[i]>=h[i+1]:
        cnt+=1
    else:
        if cnt>=ans:
            ans=cnt
            cnt=0

print(cnt)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = map(int, input().split())
if sum(A) > N:
  print(-1)
else:
  print(N - sum(A))
# Judge status: Accepted
num = input()
  
if '7' in num:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    word = list(input())
    dp = [0] * len(word)
    dp[0] = 1
    dp[1] = 1
    if word[0] != word[1]:
        dp[1] = 2
    for i in range(2, len(word)):
        if word[i] != word[i - 1]:
            dp[i] = dp[i - 1] + 1
        else:
            dp[i] = dp[i - 3] + 2
    print(dp[len(word) - 1])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
x=int(input())
a=10**5
b=0

while abs(a-b)>0.01:
	y=(a+b)/2
	if (y**2+y)/2>x:
		a=y
	else:
		b=y
print(math.ceil(b))
# Judge status: Accepted
A,B,C,K=map(int,input().split())

tot=0
all=K

if K-A>=0:
    tot+=A*1
    all-=A
    if all-B>=0:
        tot+=B*0
        all-=B
        if all-C>=0:
            tot+=-1*C
        else:
            tot+=-1*all
    else:
        tot+=0*all
else:
    tot+=1*all
print(tot)
# Judge status: Accepted
n = int(input())
ans = 1
while ans*2<=n:
    ans *= 2
print(ans)
# Judge status: Accepted
n = int(input())
print((10 ** n - 2 * 9 ** n + 8 ** n) % (10 ** 9 + 7))
# Judge status: Accepted
A = list(input().split())
print(A[0][0]+A[1][0]+A[2][0])