Harryxun/stf_run huggingface dataset:
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    table = [0] * (n*(n-1)//2+1)
    c = 0
    for i in range(n):
        for j in range(i+1, n):
            table[c] = a[i]*a[j]
            c += 1
    table = sorted(table)
    print(table[k])


main()


### FIXED CODE ###

import sys
import numpy as np
INF = 10**18+5
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a = np.sort(a)
    ap = a[a > 0]
    an = a[a < 0]
    zc = n * (n - ap.size - an.size)

    l = -INF
    r = INF
    while(l+1 < r):
        x = (l+r)//2

        total = (n-np.searchsorted(a, -(-x // an), side='left')).sum()
        if x >= 0:
            total += zc
        total += np.searchsorted(a, x // ap, side='right').sum()
        total -= a[a*a <= x].size
        total //= 2
        if total < k:
            l = x
        else:
            r = x

    print(r)


main()
n = int(input())
nums = list(map(int, input().split()))
tmp = 0
ans = 0
for num in nums:
  if num >= tmp:
    ans += 1
   	tmp = num
  else:
    break
print(ans)

### FIXED CODE ###

import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15

def main():
    n = getN()
    nums = getlist()
    hst = 0
    ans = 0
    for num in nums:
        if num >= hst:
            ans += 1
        hst = max(hst, num)

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

"""
9999
3

2916
"""
import numpy as np
N = int(input())
A_list = list(map(int, input().split()))
index = np.arange(1, N+1)
ans = ["{}\n".format(i) for A_list.count(i) in range(1, N+1)]
print(ans)

### FIXED CODE ###

import collections
N = int(input())
A_list = list(map(int, input().split()))
ans = collections.Counter(A_list)
for i in range(1, N+1):
	print(ans[i])
A,B,C = map(int,input().split())
abc = [A,B,C]
Even = []
Odd = []
for i in range(3):
    if min(abc) == abc[i]:
        idx1 = i
    elif max(abc) == abc[i]:
        idx3 = i
    else:
        idx2 = i
    if abc[i]%2 == 0:
       Even += [i]
    else:
       Odd += [i]
       
#

if len(Even) == 3 or len(Odd) == 3:
    ans = (abc[idx3]-abc[idx2])//2 + (abc[idx3]-abc[idx1])//2
elif len(Even) == 2:
    ans = 1
    abc[Even[0]] += 1
    abc[Even[1]] += 1
    ans += (abc[idx3]-abc[idx2])//2 + (abc[idx3]-abc[idx1])//2
elif len(Odd) == 2:
    ans = 1
    abc[Odd[0]] += 1
    abc[Odd[1]] += 1
    ans += (abc[idx3]-abc[idx2])//2 + (abc[idx3]-abc[idx1])//2
    
print(ans)
    



### FIXED CODE ###

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

abc = [A,B,C]
ieven = []
iodd = []
for i in range(3):
    if abc[i] % 2 == 0:
        ieven += [i]
    else:
        iodd += [i]
        
if len(ieven) == 3 or len(iodd) == 3:
    abc.sort()
    ans = (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
else:
    if len(ieven) > len(iodd):
        abc[ieven[0]] += 1
        abc[ieven[1]] += 1
        abc.sort()
        ans = 1 + (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
    else:
        abc[iodd[0]] += 1
        abc[iodd[1]] += 1
        abc.sort()
        ans = 1 + (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
        
print(ans)
n = int(input())
a = [int(input()) for _ in range(n)]
ma = max(a)
sma = sorted(A)[-2]

for i in range(n):
  if a[i] != a:
    print(ma)
  else:
    print(sma)

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
ma = max(a)
sma = sorted(a)[-2]

for i in range(n):
  if a[i] != ma:
    print(ma)
  else:
    print(sma)
N, M, C = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0

for i in range(N):
    a = list(map(int, input().split()))
    add = 0
    for j in range(M):
        add += a[j] * b[j]

    if add + C > 0:
        count += 1

print(count)


### FIXED CODE ###

h, w = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))

print((h-dh) * (w-dw))
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]


n, m = map(int, input().split())
#print(n, m)
if n == 1:
    print(0)
    exit()
a = nCr(n, 2)
print(a+m)


### FIXED CODE ###

import math
import string
import collections
from collections import Counter


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]


n, m = map(int, input().split())
print(n*(n-1)//2+m*(m-1)//2)
a, b, c, d = map(int, input().split())
if (a>=0) and (b>=0) and (c>=0) and (d>=0):
    ans=b*d
elif (b<=0) and (d<=0):
    ans=a*c
elif (a<=0) and (b>=0) and (c<=0) and (d>=0):
    tmp1=a*c
    tmp2=b*d
    if tmp1>tmp2:
        ans=tmp1
    else:
        ans=tmp2
elif (a>=0) and (b>=0) and (d<=0):
    ans=a*d
elif (c>=0) and (d>=0) and (b<=0):
    ans=b*c
elif (a<=0) and (b>=0) and (c<=0) and (d<=0):
    ans=a*c
elif (a<=0) and (b<=0) and (c<=0) and (d>=0):
    ans=a*c
print(ans)

### FIXED CODE ###

a, b, c, d = map(int, input().split())
if (a>=0) and (b>=0) and (c>=0) and (d>=0): #A
    ans=b*d
elif (b<=0) and (d<=0):#E
    ans=a*c
elif (a<=0) and (b>=0) and (c<=0) and (d>=0):#F
    tmp1=a*c
    tmp2=b*d
    if tmp1>tmp2:
        ans=tmp1
    else:
        ans=tmp2
elif (a>=0) and (b>=0) and (d<=0):#H
    ans=a*d
elif (c>=0) and (d>=0) and (b<=0):#C
    ans=b*c
elif (a<=0) and (b>=0) and (c<=0) and (d<=0):#I
    ans=a*c
elif (a<=0) and (b<=0) and (c<=0) and (d>=0):#D
    ans=a*c
elif (a>=0) and (b>=0) and (c<=0) and (d>=0):#G
    ans=b*d
elif (a<=0) and (b>=0) and (c>=0) and (d>=0):#B
    ans=b*d
print(ans)
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1,11):
        for k in range(num):
            K = (k*2+1)<<(j-1)
            if K&ng != ng:
                K &= Num-1
                dp[i+1][K] += dp[i][k]
                dp[i+1][K] %= mod

print((10**N%mod-sum(dp[N])%mod)%mod)

### FIXED CODE ###

mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(Num):
        for j in range(1,11):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 1
for i in range(N):
    cnt *= 10
    cnt %= mod
for x in dp[N]:
    cnt -= x
    cnt %= mod
print(cnt)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if (abs(A-B) % abs(W-V)) = 0 and abs(A-B) >= abs((W - V) * T):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if V > W and abs(A - B) <= abs((W - V) * T):
    print("YES")
else:
    print("NO")
answer = [1, 2, 3]

in1, in2 = map(int, input().split())

answer.remove(in1)
answer.remove(in2)

return answer[0]

### FIXED CODE ###

answer = [1,2,3]
in1 = int(input())
in2 = int(input())
answer.remove(in1)
answer.remove(in2)
print(answer[0])
a, b = map(int, input.split())
print(a * b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a * b)
n, k = map(int, input().split())
a = list(map(int, input().split()))

ans = float('inf')
for bit in range(1<<(n-1)):
  cost = 0
  cand = [0]*(n-1)
  for i in range(n-1):
    if bit & 1<<i: cand[i] = 1
  if cand.count(1) != k-1: continue
  mx = a[0]
  for i in range(1, n):
    if cand[i-1]:
      if a[i] <= mx:
        cost += prev-a[i]+1
        ms += 1
    mx = max(mx, a[j])
  ans = min(ans, cost)
print(ans)

### FIXED CODE ###

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

ans = float('inf')
for bit in range(1<<(n-1)):
  cand = [0]*(n-1)
  for i in range(n-1):
    if bit & 1<<i: cand[i] = 1
  if cand.count(1) != k-1: continue
  cost = 0
  mx = a[0]
  for i in range(1, n):
    if cand[i-1]:
      if a[i] <= mx:
        cost += mx-a[i]+1
        mx += 1
    mx = max(mx, a[i])
  ans = min(ans, cost)
print(ans)
def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0
    t = 0

    for i in range(len(C)):
        t = max(t, C[i])

    for d in range(D):
        score += S[d][t[d] - 1]
        last_d.append(t[d] - 1)
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(score)

    
if __name__ == "__main__":
    resolve()

### FIXED CODE ###

def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0

    for d in range(D):
        contest = 0
        for i in range(len(C)):
            contest = max(contest, S[d][i])
        score += contest
        last_d.append(S[d].index(contest))
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(S[d].index(contest) + 1)

    
if __name__ == "__main__":
    resolve()
class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

n, a, b = map(int, input().split())
MOD = 10**9 + 7
cmb = Combination(10**7, MOD)
print(pow(2, n, MOD) - cmb(n, a) - cmb(n, b) - 1)

### FIXED CODE ###

def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c

n, a, b = map(int, input().split())
MOD = 10**9 + 7
print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)
N, Q = map(int, input().split())
S = str(input())
position = [0] * (N)
count = 0
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i] = count

for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    print[answer]

### FIXED CODE ###

N, Q = map(int, input().split())
S = str(input())
position = [0] * N
count = 0
for i in range(N-1):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i+1] = count
answers = []
for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    answers.append(answer)
for i in range(Q):
    print(answers[i])
n = int(input())
dp = [map(int, input().split())]
for i in range(n-1):
    a, b, c = map(int, input().split())
    a0 = dp[0]
    b0 = dp[1]
    c0 = dp[2]
    
    dp[0] = max(b0, c0) + a
    dp[1] = max(c0, a0) + b
    dp[2] = max(a0, b0) + c
print(max(dp))

### FIXED CODE ###

n = int(input())
dp = [int(i) for i in input().split()]
for i in range(n-1):
    a, b, c = map(int, input().split())
    a0 = dp[0]
    b0 = dp[1]
    c0 = dp[2]
    
    dp[0] = max(b0, c0) + a
    dp[1] = max(c0, a0) + b
    dp[2] = max(a0, b0) + c
print(max(dp))
A,B,C,D,E,F = map(int,input().split())

conc = 0
total = 0

for a in range(0,31):
  for b in range(0,31):
    water = (A * a + B * b) * 100
    if water > F:
      break
    else:
      for c in range(3001):
        water = (A * a + B * b) * 100
        
        if water == 0:
          break
        #探索中の水の量に溶かせられる砂糖の限界量
        sugar_limit = int(water * E / 100)
        #操作Cで投入された砂糖の量
        sugarC = c * C
        
        if sugarC > sugar_limit:
          break
        #ビーカーに溶かせる容量
        else:
          rest = F - water - sugarC
          #水に溶かせられる砂糖量
          sugar_rest = sugar_limit - sugarC
          
          if rest < 0:
            break
          
          else:
            #操作Dで溶かせられる砂糖の量
            sugarD = (min(rest,sugar_rest) // D) * D
            sugar = sugarC + sugarD
            temp = (sugar) / (water + sugar)
            if conc < temp and temp < E:
              conc = temp
              total = water + sugar
              ans = [total,sugar]
        
print(ans[0],ans[1])



### FIXED CODE ###

A,B,C,D,E,F = map(int,input().split())

conc = 0
total = 0

ans = [100 * A,0]

for a in range(0,31):
  for b in range(0,31):
    water = (A * a + B * b) * 100
    if water > F:
      break
    else:
      for c in range(3001):
        water = (A * a + B * b) * 100
        if water == 0:
          break
        #探索中の水量に解かせる砂糖の量
        sugar_limit = int(water * E / 100)
        #操作Cで投入された砂糖の量
        sugarC = c * C
        
        if sugarC > sugar_limit:
          break
        #ビーカーに溶かせる容量
        else:
          rest = F - water - sugarC
          #水に溶かせられる砂糖量
          sugar_rest = sugar_limit - sugarC
          
          if rest < 0:
            break
          
          else:
            #操作Dで溶かせられる砂糖領
            sugarD = (min(rest,sugar_rest) // D) * D
            sugar = sugarC + sugarD
            temp = (sugar) / (water + sugar)
            if conc < temp and temp < E:
              conc = temp
              total = water + sugar
              ans = [total,sugar]
        
print(ans[0],ans[1])
while 7:
   a,b=map(int,input().split())
   if a==-a or b== -b:
    print(a+b)
   else: 
    print(a-b)

### FIXED CODE ###

for i in range(7):
 a,b=map(int,input().split())
 print(a-b)
N=int(input())
sn=[input() for _ in range(N)]
def check(s1,s2):
  for c in s1:
    if s1.count(c)!=s2.count(c):
      return False
  else:
    return True
  
cnt=0
for i in range(len(sn)-1):
  m=1
  for ii in range(i+1,len(sn)):
    if sn[ii] and check(sn[i],sn[ii]):
      cnt+=m
      m+=1
      sn[ii]=None

print(cnt)

### FIXED CODE ###

N=int(input())
dict={}
for _ in range(N):
  s=''.join(sorted(input()))
  dict[s]=dict.setdefault(s,0)+1
  
cnt=0
for c in dict.values():
  cnt+=(1+c-1)*(c-1)//2
  
print(cnt)
line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for _ in range(b):
    axb_text = f"{axb_text}{a}"

bxa_text = ''
for _ in range(a):
    bxa_text = f"{bxa_text}{b}"

print(axb_text if axb_text < bxa_text else bxa_text)

### FIXED CODE ###

line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for _ in range(b):
    axb_text += str(a)

bxa_text = ''
for _ in range(a):
    bxa_text += str(b)


print(axb_text if axb_text < bxa_text else bxa_text)
N=input("what`s the number?")
N= int(N)
N=999
if (num==2,4,5,7,9):
  print("hon")
 
elif(num==0,1,6,8):
  print("pon")
  
else:
  print("bon")


### FIXED CODE ###

n=input()
m=int(n[-1])
 
 
 
 
 
if (m)==3:
    print("bon")
elif m==6 or m==8 or m==0 or m==1:
    print("pon")
    
else:
    print("hon")
n, k = map(int, input().split())
if k!=1:
    print(n-k)
else:
    pritn(0)

### FIXED CODE ###

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

if k!=1:
    print(n-k)
else:
    print('0')
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(M)]
sc.sort()
if N == 1:
  tmp = sc[0][1]
  for i in range(M):
    if tmp != sc[i][1]:
      print(-1)
      break
  print(tmp)
else:
  pin = 0
  ans_lis = [0] * N
  tmp_s = sc[0][0]
  tmp_c = sc[0][1]
  for i in range(M):
    if sc[i][0] == 1 and sc[i][1] == 0:
      print(-1)
      pin = 1
      break
    if tmp_s == sc[i][0]:
      if tmp_c != sc[i][1]:
        print(-1)
        pin = 1
        break
    else:
      ans_lis[tmp_s -1] = tmp_c
      tmp_s = sc[i][0]
      tmp_c = sc[i][1]
  if pin == 0:
    ans_lis[tmp_s -1] = tmp_c
    if ans_lis[0] == 0:
      ans_lis[0] = 1
    lis = map(str, ans_lis)
    mojiretsu = ''
    for x in lis:
      mojiretsu += x
    print(mojiretsu)
      
      


### FIXED CODE ###

N, M = map(int, input().split())
if M == 0:
  if N == 1:
    print(0)
  elif N==2:
    print(10)
  else:
    print(100)
else:
  sc = [list(map(int, input().split())) for i in range(M)]
  sc.sort()
  pin = 0
  if N == 1:
    tmp = sc[0][1]
    for i in range(M):
      if tmp != sc[i][1]:
        print(-1)
        pin = 1
        break
    if pin == 0:
      print(tmp)
  else:
    pin = 0
    ans_lis = [0] * N
    tmp_s = sc[0][0]
    tmp_c = sc[0][1]
    for i in range(M):
      if sc[i][0] == 1 and sc[i][1] == 0:
        print(-1)
        pin = 1
        break
      if tmp_s == sc[i][0]:
        if tmp_c != sc[i][1]:
          print(-1)
          pin = 1
          break
      else:
        ans_lis[tmp_s -1] = tmp_c
        tmp_s = sc[i][0]
        tmp_c = sc[i][1]
    if pin == 0:
      ans_lis[tmp_s -1] = tmp_c
      if ans_lis[0] == 0:
        ans_lis[0] = 1
      lis = map(str, ans_lis)
      mojiretsu = ''
      for x in lis:
         mojiretsu += x
      print(mojiretsu)
ch = input()
if ch == a or ch == b or ch == c or ch == d or ch == e or ch == f or ch == g or ch == h:
  print(a)
elif ch == i or ch == j or ch == k or ch == l or ch == m or ch == n or ch == o:
  print(a)
elif ch == p or ch == q or ch == r or ch == s or ch == t or ch == u or ch == v:
  print(a)
elif ch == w or ch == x or ch == y or ch == z:
  print(a)
else
 print(b)

### FIXED CODE ###

ch = input()
if ch == 'a' or ch == 'b' or ch == 'c' or ch == 'd' or ch == 'e' or ch == 'f' or ch == 'g' or ch == 'h':
  print('a')
elif ch == 'i' or ch == 'j' or ch == 'k' or ch == 'l' or ch == 'm' or ch == 'n' or ch == 'o':
  print('a')
elif ch == 'p' or ch == 'q' or ch == 'r' or ch == 's' or ch == 't' or ch == 'u' or ch == 'v':
  print('a')
elif ch == 'w' or ch == 'x' or ch == 'y' or ch == 'z':
  print('a')
else:
 print('A')
import math
N = int(input())
G = 1
for i in range(N):
    D = int(input())
    lcm = math.floor(math.gcd(G, D))
    G = G * D // lcm
print(G)

### FIXED CODE ###

import fractions
N = int(input())
G = 1
for i in range(N):
    D = int(input())
    G = G * D // fractions.gcd(G, D)
print(G)
from collections import Counter
n = int(input())
s = input()
c = Counter(s)
tmp = c['E'] - (1 if s[0] == 'E' else 0)
best = tmp
for i in range(1, n):
    if s[i - 1] == 'W'
        tmp += 1
    else:
        tmp -= 1
    if tmp < best:
        best = tmp
print(best)

### FIXED CODE ###

from collections import Counter
n = int(input())
s = input()
c = Counter(s)
tmp = c['E']
best = tmp - (1 if s[0] == 'E' else 0)
for i in range(1, n):
    if s[i - 1] == 'W':
        tmp += 1
    else:
        tmp -= 1
    if tmp - (1 if s[i] == 'E' else 0) < best:
        best = tmp - (1 if s[i] == 'E' else 0)
print(best)
n, m = map(int, input().split())
a = [ int(input()) for _ in range(m) ]
dp = [0]*n
if not 1 in a:
  dp[0] = 1
if not 2 in a:
  dp[1] = 1 + dp[0]
for i in range(2, n):
  if i+1 in a:
    dp[i] = 0
  else:
    dp[i] = dp[i-2] + dp[i-1]
print(dp[n-1]%1000000007)

### FIXED CODE ###

n, m = map(int, input().split())
A = [ int(input()) for _ in range(m) ]
dp = [0]*(n+1)
broken = [False]*(n+1)
for i in A:
  broken[i] = True
dp[0] = 1
if not broken[1]:
  dp[1] = 1
for i in range(2, n+1):
  if broken[i]:
    continue
  else:
    dp[i] = dp[i-2] + dp[i-1]

print(dp[n]%(10**9+7))
import collections
n = int(input())
blue = []
red = []
for i in range(n):
    blue.append(input())
m = int(input())
for j in range(m):
    red.append(input())

blue_dict = collections.Counter(blue)
red_dict = collections.Counter(red)
count_list = []
for b_key, b_value in blue_dict.items():
    for r_key, r_value in red_dict.items():
        if b_key == r_key:
            count_list.append(b_value - r_value)
print('出力 : {}'.format(max(count_list)))

### FIXED CODE ###

n = int(input())
blue = []
red = []
score_list = []
for i in range(n):
    blue.append(input())
m = int(input())
for j in range(m):
    red.append(input())
for value in blue:
    score = 0
    for s in blue:
        if value == s:
            score += 1
    for t in red:
        if value == t:
            score -= 1
    if score not in score_list:
        score_list.append(score)
if max(score_list) < 0:
    print(0)
else:
    print(max(score_list))
N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
BC = [list(map(int, input().split(" "))) for _ in range(M)]

A.sort()
BC.sort(key=lambda x: x[1], reverse=True)

i = 0
for b, c in BC:
    for j in range(b):
        A[i] = max(A[i], c)
        i += 1

print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
BC = [list(map(int, input().split(" "))) for _ in range(M)]

A.sort()
BC.sort(key=lambda x: x[1], reverse=True)

i = 0
for b, c in BC:
    for j in range(b):
        A[i] = max(A[i], c)
        i += 1
        if i >= N:
            print(sum(A))
            exit()

print(sum(A))
X,Y=map(int,input().split())
import math
def f2(r):

    return inv_t
def co(n,r):
    P = 10**9 + 7
    N = r+1
    inv_t = [0]+[1]
    for i in range(2,N+1):
        inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
    ans =1
    for i in range(1,r+1):
        ans = (ans * (n+i-1)) % P
    for i in range(1,r+1):
        ans = (ans * inv_t[i]) % P
    return ans
if (X+Y)%3==0:
    Z=X+Y
    if min(X,Y)-Z//3 >-1:
        #print(1)
        comb = Combination(Z)
        print(comb(Z//3,min(X,Y)-Z//3))
        #print(co(Z//3,min(X,Y)-Z//3))
    else:
        print(0)
else:
    print(0)

### FIXED CODE ###

X,Y=map(int,input().split())
import math

def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

def f2(r):

    return inv_t
def co(n,r):
    P = 10**9 + 7
    N = r+1
    inv_t = [0]+[1]
    for i in range(2,N+1):
        inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
    ans =1
    for i in range(1,r+1):
        ans = (ans * (n+i-1)) % P
    for i in range(1,r+1):
        ans = (ans * inv_t[i]) % P
    return ans
if (X+Y)%3==0:
    Z=X+Y
    if min(X,Y)-Z//3 >-1:
        #print(1)
        print(combination(Z//3,min(X,Y)-Z//3))
        #print(co(Z//3,min(X,Y)-Z//3))
    else:
        print(0)
else:
    print(0)
while True:
    cards = raw_input()
    if cards == '-':
        break
    shuffle_num = int(raw_input())
    counter = 0
    while counter < num:
        h = int(raw_input)
        cards = cards[h:] + cards[:h]
        num += 1
    print(cards)

### FIXED CODE ###

while True:
    cards = raw_input()
    if cards == '-':
        break
    shuffle_num = int(raw_input())
    counter = 0
    while counter < shuffle_num:
        h = int(raw_input())
        cards = cards[h:] + cards[:h]
        counter += 1
    print(cards)