Harryxun/stf_run huggingface dataset:
n = int(input())
tree = [None for i in range(n)]
root = set(range(n))

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= {1, r}

def preorder(i):
    if i == -1:
        return
    print(' ', i, sep = '', end = '')
    preorder(left[i])
    preorder(right[i])
      
def inorder(i):
    if i == -1:
        return
    inorder(left[i])
    print(' ', i, sep = '', end = '')
    inorder(right[i])
      
def postorder(i):
    if i == -1:
        return
    postorder(left[i])
    postorder(right[i])
    print(' ', i, sep = '', end = '')

print('Preorder')
preorder(root)
print()
  
print('Inorder')
inorder(root)
print()
  
print('Postorder')
postorder(root)
print()

### FIXED CODE ###

n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = sum(range(n)) - n - 1

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def Preorder(i):
    if (i == -1):
        return
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])
      
def Inorder(i):
    if (i == -1):
        return
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])
      
def Postorder(i):
    if (i == -1):
        return
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()
  
print("Inorder")
Inorder(root)
print()
  
print("Postorder")
Postorder(root)
print()
from math import sqrt


def main():
    if c - a - b < 0:
        print('No')
    if 4 * a * b < (c - a - b) * (c - a - b):
        print('Yes')
    else:
        print('No')


main()


### FIXED CODE ###

from math import sqrt


def main():
    a, b, c = map(int, input().split())
    if c - a - b < 0:
        print('No')
        exit()

    if 4 * a * b < (c - a - b) * (c - a - b):
        print('Yes')
    else:
        print('No')


main()
if __name__ == "__main__":
    N = input()
    for x in range(0, 100):
        y = N - 4 * x
        if y % 7 == 0:
            print ("Yes")
            exit(0)
    print ("No")

### FIXED CODE ###

if __name__ == "__main__":
    N = int(input())
    for x in range(0, 100):
        y = N - 4 * x
        if y < 0:
            break
        if y % 7 == 0:
            print ("Yes")
            exit(0)
    print ("No")
N=input()
A=list(input().split(" "))
for n in range(1,int(N)):
    print(A.count(n))


### FIXED CODE ###

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

tmp=0
ca=[0]
for ai in a:
  tmp+=ai
  ca.append(tmp)
tmp=0
cb=[0]
for bi in b:
  tmp+=bi
  cb.append(tmp)
import bisect
s=bisect.bisect_right(ca,k)-1
ans=ca[s]
now_a=s
z=k-ca[now_a]
now_b=bisect.bisect_right(cb,z)-1
t=ca[now_a]+cb[now_b]
ans=now_a+now_b
for i in range(s):
  now_a-=1
  t-=a[now_a]
  while t+b[now_b]<=k:
    t+=b[now_b]
    now_b+=1
  ans=max(ans,now_a,now_b)
print(ans)



### FIXED CODE ###

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

tmp=0
ca=[0]
for ai in a:
  tmp+=ai
  ca.append(tmp)
tmp=0
cb=[0]
for bi in b:
  tmp+=bi
  cb.append(tmp)
import bisect
s=bisect.bisect_right(ca,k)-1
ans=ca[s]
now_a=s
z=k-ca[now_a]
now_b=bisect.bisect_right(cb,z)-1
t=ca[now_a]+cb[now_b]
#print(now_a,now_b)
ans=now_a+now_b
for i in range(s):
  now_a-=1
  t-=a[now_a]
  while now_b<m and t+b[now_b]<=k:
    t+=b[now_b]
    now_b+=1
  ans=max(ans,now_a+now_b)
print(ans)
s = input()
for i in range(s):
  if s[i] ='B':
    s[i] = 'R'
print("".join(s))

### FIXED CODE ###

s = input()
if s== 'ABC':
    print("ARC")
elif s=='ARC':
    print("ABC")
else:
    pass
n = int(input())
A = list(map(int,input().split()))
import fractions
g = fractions.gcd(A[0],A[1])
for i in range(2,n):
  g = fracitons.gcd(g,A[i])
print(g)

### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
import fractions
g = fractions.gcd(A[0],A[1])
for i in range(2,n):
  g = fractions.gcd(g,A[i])
print(g)
# # Educational DP Contest E
# 方針：dp[i][w] := i番目の物の中から，重さwを超えない時の価値の最大値
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
wv.sort()
if N == 1:
    if wv[0][0] <= W:
        print(wv[0][1])
    else:
        print(0)
    exit()

dp = [[0] * (W+1) for _ in range(N+1)]
weight_possible_now = wv[0][0]


for i in range(N):
    if wv[i-1][0] < W:
        dp[i+1][:wv[i][0]] = dp[i][:wv[i][0]]
    weight_possible_now += wv[i][0]
    for w in range(wv[i][0], W+1):
        if weight_possible_now < W and w == weight_possible_now:
            dp[i+1][w+1:] = [dp[i+1][w]] * (W + 1 - w)
            break
        else:
            if w >= wv[i][0]:
                dp[i+1][w] = max(dp[i][w - wv[i][0]] + wv[i][1], dp[i][w])
            else:
                dp[i+1][w] = dp[i][w]
print(dp[N][W])

### FIXED CODE ###

# # Educational DP Contest E
# 方針：dp[i][v] := i-1番目までの物の中から，価値v以上を達成するように選んだ時の重さの最小値

# 入力
N, W = map(int, input().split())
weight = [0] * N
value = [0] * N
for i in range(N):
    w, v = map(int, input().split())
    weight[i] = w
    value[i] = v

# DPテーブル
max_v = sum(value)
dp = [[float("inf")] * (max_v + 1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
    for v in range(max_v+1):
        if v >= value[i]:       # i番目の物を選ぶ時
            dp[i+1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])
        else:
            dp[i+1][v] = dp[i][v]

for v in range(max_v, -1, -1):
    if dp[N][v] <= W:
        ans = v
        break
print(ans)
N=int(input())
b=list(map(int,input().split()))
flg=True

ans = [0 for i in range(N)]
for i in range(N):
    for j in range(N-i):
        if b[N-i-j-1]==N-i-j:
            del b[N-i-j-1]
            #print(b)
            ans[N-i-1]=N-i-j
            break

for a in ans:
    if a==0:
        flg=False
        break
#print(ans)
if flg:
    for a in ans:
        print(a)
else:
    print(-1)

### FIXED CODE ###


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

def atoi(a):
    alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
                'p','q','r','s','t','u','v','w','x','y','z']
    return alphabet.index(a)

a_list = [0 for i in range(26)]
for i in range(N):
    a_list[atoi(S[i])]+=1
ans = 1
for i in range(26):
    ans *= (a_list[i]+1)
    ans = ans%(10**9 + 7)
if ans>0:
    ans-=1
else:
    ans=10**9 + 6
print(ans)
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
import math
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

def main():
  mod = 10**9 + 7
  n, m = map(int, input().split())
  dp = [0] * n
  memo = [1] * n
  for _ in range(m):
    i = int(input())
    memo[i-1] = 0
  if memo[0]:
    dp[0] = 1
  if memo[1]:
    dp[1] += dp[0] + 1
  for i in range(2,n):
    if memo[i]:
      dp[i] = dp[i-1]%mod + dp[i-2]%mod
  print(dp[n-1])
  

if __name__ == '__main__':
  main()

### FIXED CODE ###

from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, m = map(int, readline().split())
  A = list(int(readline()) for i in range(m))
  A.append(INF)
  dp = [0]*(n+1)
  dp[0] = 0
  j = 0
  if A[j] == 1:
    dp[1] = 0
    j += 1
  else:
    dp[1] = 1
  
  if n>=2:
    if A[j] == 2:
      dp[2] = 0
      j += 1
    else:
      dp[2] = dp[1] + 1
  
  if n>=3:
    for i in range(3, n+1):
      if A[j] == i:
        dp[i] = 0
        j += 1
      else:
        dp[i] = (dp[i-1]+dp[i-2])%MOD
  print(dp[n])
  
if __name__ == '__main__':
  main()
n = int(input())
a = list(map(int, input().split()))
sadlist = []
for h in range(n):
    a[h] = a[h] - (h + 1)
for i in range(min(a), max(a)):
    sad = 0
    for j in range(n):
        sad = sad + abs(a[j] - i)
    sadlist.append(sad)
print(min(sadlist))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
for j in range(n):
    a[j] = a[j] - (j + 1)
a.sort()
if n % 2 == 0:
    print(sum(a[int(n / 2):]) - sum(a[:int(n / 2)]))
else:
    print(sum(a[int((n + 1) / 2):]) - sum(a[:int((n - 1) / 2)]))
A, B = map(int, input().split())
if A == B:
  print('Draw')
else:
  print( 'Alice' if A if A != 1 else A+13 > B if B != 1 else B+ 13 else 'Bob')

### FIXED CODE ###

A, B = map(int, input().split())
if A == B:
  print('Draw')
else:
  print( 'Alice' if (A if A != 1 else A+13) > (B if B != 1 else B+13) else 'Bob')
a,b = map(int, input().split())

if a <= b:
    return a
else:
    return b

### FIXED CODE ###

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

if a<= b:
    print(a)
else:
    print(a-1)
n = ""
while True:
    try:
        c = raw_input().lower()
        if c != ""
            n = n + c
    except:
        break

n = list(n)
charac = []
for j in range(97,97+26):
    m= 0
    for i in range(0,len(n)):
        if ord(n[i]) == j:
            m += 1
        charac.append("{} : {}".format(chr(j),m))

for i in range(0,26):
    print(charac[i])

### FIXED CODE ###

s =""
while True:
    try:
        s += input().lower()
    except:
        break
    
s = list(map(ord,list(s)))
for i in range(ord("a"),ord("z")+1):
    print(chr(i) + " : " + str(s.count(i)))
#A - Rainy Season
Si = []
Si = list(str(input()))
i = 0
if Si.count('S') == 3:
    i = 0
else:
    if Si.count('R') == 3:
        i = 3
    else:
        if Si.count('R') == 1:
            i = 1
        else:
            if Si[1] == 'S':
                 = 1
            else:
                i = 2
# 出力
print(i)

### FIXED CODE ###

#A - Rainy Season
Si = []
Si = list(str(input()))
i = 0
if Si == ['S','S','S']: i = 0
if Si == ['R','S','S']: i = 1
if Si == ['S','R','S']: i = 1
if Si == ['S','S','R']: i = 1
if Si == ['R','R','S']: i = 2
if Si == ['S','R','R']: i = 2
if Si == ['R','S','R']: i = 1
if Si == ['R','R','R']: i = 3
# 出力
print(i)
N = list(input())
N.appnd('Z')
for i in range(len(N)-1):
  if N[i] in'ACGT':
    N[i] += 1
    N[i+1] = N[i]
  else:
    N[i] = 0
print(max(N))


### FIXED CODE ###

N = list(input())
dp = [0]*(len(N)+1)
for i in range(len(N)):
  if N[i] in'ACGT':
    dp[i] += 1
    dp[i+1] = dp[i]
  else:
    dp[i] = 0
print(max(dp))
import sys

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

Result = ''

Count_Blue = 0
if 1<=N<=10**18 and A >= 0 and B >= 0 and \
   0< A + B <= 10**18:
    for Count in range(1,10**100+1):
        if len(Result) < N:
            Mod = Count % 2
            if Mod==1:
                for i in range(A):
                    if len(Result) < N:
                        Result = Result + 'B'
                        Count_Blue += 1
            elif Mod==0:
                Result = Result + 'R' * B
        else:
            print(Count_Blue)
            sys.exit()



### FIXED CODE ###

import sys

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

Count_Blue = 0
if 1<=N<=10**18 and A > 0 and B >= 0 and \
   0< A + B <= 10**18:
    Add_Blue = 1 * A
    Add_Both = Add_Blue + 1 * B

    q = N // Add_Both
    mod = N % Add_Both
    if mod < Add_Blue:
        Count_Blue = (q *Add_Blue) + mod
    else:
        Count_Blue = (q * Add_Blue) + Add_Blue
    print(Count_Blue)
elif A == 0:
    print(Count_Blue)
a,b = map(int,input().split())
if a or b >= 10:
    print(-1)
else:
    print(a*b)

### FIXED CODE ###

n = int(input())
list = []

for i in range(1,10):
    for j in range(1,10):
        c = i*j
        list.append(c)
if n in list:
    print("Yes")
else:
    print("No")
c=input()
l="qwertyuioplkjhgfdsazxcvbnm"
l.sort()
print(l[l.index(c)+1])

### FIXED CODE ###

c=input()
print(chr(ord(c)+1))
N, k = map(int, input().split())
s = input()

l = len(s)
mx = 0 

def count_consecutive(s):
    return max(list(map(lambda x: len(x), s.split('0'))))

def dfs(s, k, st):
    global mx
    if k == 0: return count_consecutive(s)
    for i in range(st, l): 
        if s[i] == '0':
            count = 0 
            while i+count < l and s[i+count] == '0':
                count += 1
            mx = max(dfs(s[:i] + '1'*count + s[i+count:], k-1, i+count), mx) 
    return max(count_consecutive(s), mx)                                                                       

print(dfs(s, k, 0)) 

### FIXED CODE ###

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

l, accum = len(s), []
i = 0
while i < l:
    ch = s[i]
    count = 0
    while i < l and s[i] == ch:
        count += 1
        i += 1
    accum.append(count)

l = len(accum)
for i in range(1, l): accum[i] += accum[i-1]

mx = accum[min(2*k - (1-int(s[0])), l-1)]
i = 1
while l > 1:
    idx = min(2*k - (1-int(s[0])) + 2*i, l-1)
    mx = max(accum[idx] - accum[2*(i-1)+int(s[0])], mx)
    if idx >= l-1: break
    i += 1
print(mx)
a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a + b) % == 0 else "Impossible")

### FIXED CODE ###

a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0 else "Impossible")
def insertion(S):
    Sc = S
    Scc = Sc.replace("()", "")
    while Scc != Sc:
        Sc = Scc
        Scc = Scc.replace("()", "")

    # Sc は ((((... or ))))... or ...))))((((...
    # print(Sc)
    if Sc[0] != Sc[-1]:
        pos = Sc.find(")(")
        S = insertion(S[:pos+1]) + insertion(S[pos+1:])
    elif Sc[0] == '(':
        S += ')' * len(Sc)
    else:
        S = '(' * len(Sc) + S

    return S

N = int(input())
print(insertion(input()))


### FIXED CODE ###

def insertion(S):
    Sc = S
    Scc = Sc.replace("()", "")
    while Scc != Sc:
        Sc = Scc
        Scc = Scc.replace("()", "")

    # Sc は ((((... or ))))... or ...))))((((...
    # print(Sc)
    if len(Sc) == 0:
        Sl, Sr = "", ""
    elif Sc[0] != Sc[-1]:
        pos = Sc.find(")(")
        Sl = insertion(Sc[:pos+1])[0]
        Sr = insertion(Sc[pos+1:])[2]
    elif Sc[0] == '(':
        Sl = ""
        Sr = ')' * len(Sc)
    else:
        Sl = '(' * len(Sc)
        Sr = ""

    return Sl, S, Sr

N = int(input())
s = insertion(input())
print(s[0]+s[1]+s[2])
n=int(input())
cnt_2=0
cnt_10=0
if n%2==1:
    print(0)
else:

    for i in range(1000):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

### FIXED CODE ###

n=int(input())
cnt_10=0
MAX_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)
A,B = map(int,input().split())

if A =< 9:
  if B =< 9:
    x = A*B
  else x = -1
else x = -1

print(x)
		

### FIXED CODE ###

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

if A <= 9:
  if B <= 9:
    x = A*B
  else:
    x = -1
else:
  x = -1

print(x)
N, K= map(int, input().split())
h = list(map(int, input().split()))
import numpy as np
dp = np.zeros((N+1, K+1), dtype=int)
for i in range(1, N):
    for k in range(1, K+1):
        if i >= k:
            dp[i+1][k] = abs(h[i] - h[i - k]) + min(dp[i + 1 - k][1:K + 1])
        else:
            w = i
            dp[i+1][k] = dp[i+1][k-1]
print(min(dp[N][1:K+1]))

### FIXED CODE ###

N, K= map(int, input().split())
h = list(map(int, input().split()))
dp = [0]*(N+1)
for i in range(1, N):
    dp[i+1] = min(
        [
            abs(h[i]-h[i-k]) + dp[i+1-k]
            for k in range(1, min(K, i)+1)
        ]
    )
print(dp[N])
import math
a=int(input())
b=int(input())
print(math.ceil(math.log10(a*b)))

### FIXED CODE ###

import sys,math

inputs = list()

for n in sys.stdin:
	inputs.append(list(map(int,n.split())))

for n in inputs:
	print(math.floor(math.log10(n[0]+n[1]))+1)
n, a, b, c, d = map(int, input().split())
s = set(input())

if '##' in s[a-1:d]:
    print('No')
    exit()

if c < d:
    print('Yes')
    exit()

if '...' in s[b-2:d+1]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n, a, b, c, d = map(int, input().split())
s = input()

if '##' in s[a-1:d]:
    print('No')
    exit()

if c < d:
    print('Yes')
    exit()

if '...' in s[b-2:d+1]:
    print('Yes')
else:
    print('No')
# １行の入力データを分割
data = input().split() # "1 2 3"と入力
# 入力データの数値化
nums = list(map(int, input().split()))
A = nums[0] 
B = nums[1]
C = nums[2]

count=0

while (C>0):
  C = C - 1
  count = count +1
  if B>0:
    B = B-1
    count  = count +1
  elif A>0:
    A = A-1
  else:
    while(B>0):
      B = B -1
      count = count +1
    break
print(count)


### FIXED CODE ###

# 入力データの数値化
nums = list(map(int, input().split()))
A = nums[0] 
B = nums[1]
C = nums[2]

count=0

if C-1-B <= 0 or C-1-B <=A:
  print(C+B)
else:
  print(1+2*B+A)
import numpy as np

def calc(n):
    if n < 2:
        return 0
    lim = int((n - 2) ** 0.5 - 1) + 1

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index>n:continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]

for i in calc(int(input())):
    print(i)

### FIXED CODE ###

import numpy as np


def calc(n):
    #     lim = int((n - 2) ** 0.5 - 1) + 1
    lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)
a = print()
if a%2 ==0:print(a)
else:print(2*a)

### FIXED CODE ###

a = input()
a = int(a)
if a%2 ==0:print(a)
else:print(2*a)
ab = input().split()
coin = 0
for i in range(2):
  if ab[0] >= ab[1]:
    coin += ab[0]
    ab[0] = ab[0] - 1 
  else:
    coin += ab[1]
    ab[1] = ab[1] - 1 
print(coin)

### FIXED CODE ###

ab = input().split()
ab[0] = int(ab[0])
ab[1] = int(ab[1])
coin = 0
for i in range(2):
  if ab[0] >= ab[1]:
    coin += ab[0]
    ab[0] = ab[0] - 1 
  else:
    coin += ab[1]
    ab[1] = ab[1] - 1 
print(coin)
def common():
????x = raw_input()
????a = len(x)
  y = raw_input()
????b = len(y)
????k1 = [0 for i in range(b+1)]
????
????for i in range(a):
????????k2 = k1 + []
????????for j in range(b):
????    if x[i] == y[j]:
?????????????? k1[j+1] = k2[j] + 1
      elif k1[j+1] < k1[j]:
????????????????k1[j+1] = k1[j]
  
  return k1[-1]

n = input()
for l in range(n):
????print common()

### FIXED CODE ###

def common():
  X = raw_input()
  Y = raw_input()
  a = len(X)
  b = len(Y)
  k1 = [0 for i in range(b+1)]
 
  for i in range(a):
     k2 = k1 + []
     for j in range(b):
       if X[i] == Y[j]:
          k1[j+1] = k2[j] + 1
       elif k1[j+1] < k1[j]:
          k1[j+1] = k1[j]
 
  return k1[-1]
 
n = input()
for l in range(n):
  print common()
s = int(input())
n = 0
if s==1 or s == 2:
  print("4")
elif s==3:
  print("9")
if s >=4:
  while s % 2 == 0:
  s = s/2
  n += 1
  if s!=1 and s%2 == 1:
    s = 3*s+1
    n+=1
  if s == 1:
    print(n+2)
    break



### FIXED CODE ###

s = int(input())
n = 0
if s==1 or s == 2:
  print("4")
elif s==3:
  print("9")
if s >=4:
  s = 2*s
  while s % 2 == 0:
    s = s/2
    n += 1
    if s!=1 and s%2 == 1:
      s = 3*s+1
      n+=1
    if s == 1:
      print(n+1)
      break
a, b, c, x, y = map(int,input().split())

mast = max(x,y)
ans =  c *2 *i

for i in range(mast+1):
    price = a * max(x-i,0) + b * max(y-i,0) + c *2 *i
    ans =min(ans,price) 
    
print(ans)

### FIXED CODE ###

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

mast = max(x,y)
ans = float('INF')

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

print(s.count('ABC'))

### FIXED CODE ###

n = input()
s = input()
 
print(s.count('ABC'))
from itertools import product

A,B,C,D,E,F = map(int, input().split())
num_a = F // (100 * A)
num_b = F // (100 * B) 
num_c = int((F * E / (E + 100)) // C)
num_d = int((F * E / (E + 100)) // D)

def check_w(w_mizu, w_sato, F):
  return w_mizu + w_sato <= F

def check_tokeru(w_mizu, w_sato, E):
  return 100 * w_sato / (w_mizu + w_sato) <= 100 * E / (100 + E)

def culc_density(w_mizu, w_sato):
  return 100 * w_sato / (w_mizu + w_sato)

max = [0, 0, 0]  # total, sato, density
for _a, _b,  in product(range(num_a + 1), range(num_b + 1)): 
  w_mizu = (A * _a + B * _b) * 100
  if w_mizu == 0 or w_mizu >= F:
    continue
    
  for _c, _d in product(range(num_c + 1), range(num_d + 1)):
    w_sato = (C * _c + D * _d)
    if w_sato == 0 or w_sato >= F or (w_mizu + w_sato) > F:
      continue
    
    density = culc_density(w_mizu, w_sato)
  
    if check_w(w_mizu, w_sato, F) and check_tokeru(w_mizu, w_sato, E):
      if max[2] < density:
        max[0] = w_mizu + w_sato
        max[1] = w_sato
        max[2] = density

if max[0]:
  print(max[0], max[1])
else:
  print(F, 0)


### FIXED CODE ###

N = int(input())
A = int(input())
print(N**2 - A)
n = int(input())
a = [input() for i in range(n)]

min_value = -200000

for a in range(a)
    max_value = max(max_value,a - min_value)
    min_value = min(min_value,a)
print(max_value-min_value)



### FIXED CODE ###

n = int(input())
R = [int(input()) for i in range(n)]

minv = R[0]
maxv = R[1] - R[0]
for j in range(1, n):
	if (maxv < R[j] - minv):
		maxv = R[j] - minv
	if (R[j] < minv):
		minv = R[j]
    
print(maxv)
from math import factorial
N,M=list(map(int,input().split()))

ans=1
flag=True
if M>0:
    dansa=[int(input()) for _ in range(M)]
    if dansa[0]==0:
        print("0")
    else:
        if len(dansa)>1:
            for i in range(M-1):
                if dansa[i]+1==dansa[i+1]:
                    print("0")
                    flag=False
                    break
    if flag:
        dansa.insert(0,0)
        dansa.append(N)
        for i in range(M+1):
            tmp=dansa[i+1]-dansa[i]-1
            arr=[i for i in range(int(tmp/2)+1)]
            #print("tmp:{}".format(tmp))
            hoge=0
            """
            if tmp%2==0:
                arr=[j*2 for j in range(0,int(tmp/2+1))]

            else:
                arr=[j*2+1 for j in range(0,int((tmp+1)/2))]
            """
            #print(arr)
            #if tmp%2==0:
            for k in arr:
                n=tmp-k
                hoge+=factorial(n) / factorial(k) / factorial(n-k)

            #print(hoge)
            ans=ans*hoge
            #print(ans)
        print(int(ans%1000000007))
        #print(ans)
else:
    tmp=N
    arr=[i for i in range(int(tmp/2)+1)]
    hoge=0
    for k in arr:
                n=tmp-k
                hoge+=factorial(n) / factorial(k) / factorial(n-k)
    ans=hoge
    print(ans)


### FIXED CODE ###




mod=10**9+7
n,m=list(map(int,input().split()))
a=[int(input()) for _ in range(m)]
fib=[1,1]
c=0
if m>0 and a[0]==1:
    fib[1]=0
    c+=1
for i in range(2,n+1):
    if c<m and a[c]==i:
        fib.append(0)
        c+=1
    else:
        fib.append((fib[i-2]+fib[i-1])%mod)

print(fib[n])