Harryxun/stf_run huggingface dataset:
n, x, d = map(int, input().split())

if d == 0:
  if x == 0:
    print(1)
    exit
  else:
    print(n + 1)
    exit
if d < 0:
  y = x
  x = x + d * (n - 1)
  d = -d
else:
  y = x + d * (n - 1)
  
U = {}
ans = 0
has0 = 0
for k in range(1, n + 1):
  r = (x * k) % d
  s = k * d * (k - 1) // 2
  v1 = k * x + s
  v2 = k * y - s
  if r in U:
    u = U[r]
    if v1 > u[1] or v2 < u[0]:
      ans += (u[1] - u[0]) // d + 1
    else:
      v1 = min(v1, U[r][0])
      v2 = max(v2, U[r][1])
  U[r] = (v1, v2)
  if r == 0 and v1 <= 0 and v2 >= 0:
    has0 = 1
#  print(ans, k, v1, v2, U)

for r, u in U.items():
  ans += (u[1] - u[0]) // d + 1

if not has0: ans += 1
  
print(ans)

### FIXED CODE ###

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

if d == 0:
  if x == 0:
    print(1)
    exit()
  else:
    print(n + 1)
    exit()
if d < 0:
  y = x
  x = x + d * (n - 1)
  d = -d
else:
  y = x + d * (n - 1)
  
U = {}
ans = 0
has0 = 0
for k in range(1, n + 1):
  r = (x * k) % d
  s = k * d * (k - 1) // 2
  v1 = k * x + s
  v2 = k * y - s
  if r in U:
    u = U[r]
    if v1 > u[1] or v2 < u[0]:
      ans += (u[1] - u[0]) // d + 1
    else:
      v1 = min(v1, U[r][0])
      v2 = max(v2, U[r][1])
  U[r] = (v1, v2)
  if r == 0 and v1 <= 0 and v2 >= 0:
    has0 = 1
#  print(ans, k, v1, v2, U)

for r, u in U.items():
  ans += (u[1] - u[0]) // d + 1

if not has0: ans += 1
  
print(ans)
a, b = map(int, input().split())
diff = b - a

def generate(n):
    if n == 1:
        return 1
    return generate(n-1) + n

print(generate(diff) - b)

### FIXED CODE ###

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

tower = 0

for i in range(1, b - a + 1):
    tower += i

print(tower - b)
num = int(input())
Flag = True
for x in range(2,10):
  if num % x == 0:
    Flag = False
    break
if flag:
  print("NO")
else:
  print("YES")


### FIXED CODE ###

num = [int(_) for _ in input().split(" ")]
if 0<num[0]<10 and 0<num[1]<10:
  print(num[0]*num[1])
else:
  print(-1)
# 2019/07/24

from collections import Counter

n=int(input())
v=list(map(int,input().split()))

even=[]
odd=[]

for i in range(n):
    if i%2==0:even.append(v[i])
    else:odd.append(v[i])

e=Counter(even).most_common(2)
e=list([e[0][0]]+[e[1][0]])
o=Counter(odd).most_common(2)
o=list([o[0][0]]+[o[1][0]])
ans=float('inf')
for i in e:
    for j in o:
        cnt=0
        if i==j:continue
        for k in range(n):
            if k%2==0 and v[k]!=i:
                cnt+=1
            elif k%2==1 and v[k]!=j:
                cnt+=1
        ans=min(cnt,ans)

print(ans)

### FIXED CODE ###

# 2019/07/24

from collections import Counter

n=int(input())
v=list(map(int,input().split()))

even=[]
odd=[]

for i in range(n):
    if i%2==0:even.append(v[i])
    else:odd.append(v[i])

e=Counter(even).most_common(2)
if len(e)<2:e=[e[0][0]]
else:e=list([e[0][0]]+[e[1][0]])
o=Counter(odd).most_common(2)
if len(o)<2:o=[o[0][0]]
else:o=list([o[0][0]]+[o[1][0]])

ans=float('inf')
for i in e:
    for j in o:
        cnt=0
        if i==j:continue
        for k in range(n):
            if k%2==0 and v[k]!=i:
                cnt+=1
            elif k%2==1 and v[k]!=j:
                cnt+=1
        ans=min(cnt,ans)

if ans==float('inf'):ans=n//2
print(ans)
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
count=0
if sum(A)<sum(B):
    print(-1)
else:
    dif=[A[i]-B[i] for i in range(N)]
    if min(dif)>=0:
        print(0)
    else:
        difsort=sorted(dif)
        pluslist=[i for i in difsort if i>=0][::-1]
        minlist=[i for i in difsort if i<0]
        minum=len(minlist)
        absum=abs(sum(minlist))
        sumlist=[sum(maxsort[0:i+1]) for i in range(len(pluslist)-1)]
        while sumlist[count]<absum:
            count+=1
        
        print(count+1+minum)

### FIXED CODE ###

N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
count=0
if sum(A)<sum(B):
    print(-1)
else:
    dif=[A[i]-B[i] for i in range(N)]
    if min(dif)>=0:
        print(0)
    else:
        difsort=sorted(dif)
        plist=[i for i in difsort if i>=0][::-1]
        mlist=[i for i in difsort if i<0]
        mnum=len(mlist)
        msum=sum(mlist)
        for i in range(len(plist)):
            if msum>=0:
                break
            msum+=plist[i]
            count+=1
            
        
        print(count+mnum)
S = list(input())
result = []
if len(set(S))==2:
  for s in S:
    result.append(S.count(s))
    if result[0]==result[1]:
      print("Yes")
    else:
      print("No")
else:
  print("No")

### FIXED CODE ###

S = list(input())
result = []
if len(set(S))==2:
  for s in list(set(S)):
    result.append(S.count(s))
  if result[0]==result[1]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
def combi(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
def b(k,i):
  return combi(k-1,i)

def r(n,k,i):
  return combi(n-k+1,i+1)
  
def main():
  n,k = map(int,input().split())	
  
  
  for i in range(k):
    print(b(k,i)*r(n,k,i)%(10**9+7))
  

import sys
input = sys.stdin.readline
import math  
main()

### FIXED CODE ###

from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n,k = map(int,input().split())
    dp = [[0 for _ in range(k+1)] for _ in range(k+1)]
    dp[0][0] = 1
    for i in range(1,k+1):
        for j in range(1,i+1):
            dp[i][j] = (dp[i-1][j]*(i+j-1)+dp[i-1][j-1]*(n-k-j+2))//i
    for i in range(1,k+1):
        print(dp[-1][i]%mod)

if __name__ == "__main__":
    main()
import math
n,m,q=map(int,input().split())
abcd=[list(map(int,inpt().split())) for _ in range(q)]
sumlist=[]
for A in math.combinations_with_replacement(range(1,m+1),n)
  sum=0
  for a,b,c,d in abcd:
    if A[b-1]-A[a-1]==c:
      sum+=d
    sumlist.append(sum)
print(max(sumlist))
      

### FIXED CODE ###

import itertools
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split())) for _ in range(q)]
sumlist=[]
for A in itertools.combinations_with_replacement(range(1,m+1),n):
  sum=0
  for a,b,c,d in abcd:
    if A[b-1]-A[a-1]==c:
      sum+=d
    sumlist.append(sum)
print(max(sumlist))
n,m=map(int,input().split())
bridge=[[] for i in range(m)]
iland=[[i+1] for i in range(n)]
for i in range(m):
    bridge[i]=list(map(int,input().split()))
ans=[0 for i in range(m+1)]
ans[0]=int((n-1)*n/2)
k=1
for i in reversed(bridge):
    ans[k]=ans[k-1]
    for j in range(i[0]):
        if i[0] in iland[j]:
            temp=j
            break
    for j in range(i[1]):
        if i[1] in iland[j]:
            if temp!=j:
                ans[k]=ans[k-1]-len(iland[j])*len(iland[temp])
                iland[j].extend(iland[temp])
                del iland[temp]
                break
    if ans[k]==0:
        ans[k:]=[0 for l in range(m-k)]
        break
    k+=1
for i in range(m):
    print(ans[m-1-i])

### FIXED CODE ###

n,m=map(int,input().split())
bridge=[[] for i in range(m)]
leader=[i for i in range(n+1)]
member=[1 for i in range(n+1)]
for i in range(m):
    bridge[i]=list(map(int,input().split()))
ans=[0 for i in range(m+1)]
ans[0]=int((n-1)*n/2)
k=1
for i in reversed(bridge):
    le0=leader[i[0]]
    le1=leader[i[1]]
    while le0!=leader[le0]:
        le0=leader[le0]
        leader[i[0]]=le0
        
    while le1!=leader[le1]:
        le1=leader[le1]
        leader[i[1]]=le1
        
    if le0!=le1:
        ans[k]=ans[k-1]-member[le0]*member[le1]
        if member[le0]>=member[le1]:
            member[le0]+=member[le1]
            leader[le1]=le0
        else:
            member[le1]+=member[le0]
            leader[le0]=le1
    else:
        ans[k]=ans[k-1]
    if ans[k]==0:
        ans[k:]=[0 for l in range(m-k)]
        break
    k+=1
for i in range(m):
    print(ans[m-1-i])
import sys

n, m = map(int, input().split())
dp = [-1] * (1 << n)
dp[0] = 0
bits = [0] + [1 << i for i in range(n)]
get_bits = bits.__getitem__

for _ in [0] * m:
  a, b = map(int, sys.stdin.readline())
  s = sum(map(get_bits, map(int, sys.stdin.readline())))
  for t in range(1 << n):
    if (dp[t] == -1):
      continue
    dp[t | s] = min(dp[t | s], dp[t] + a)

print(dp[-1])


### FIXED CODE ###

import sys

n, m = map(int, input().split())
INF = 10 ** 9
dp = [INF] * (1 << n)
dp[0] = 0
bits = [0] + [1 << i for i in range(n)]
get_bits = bits.__getitem__

for _ in [0] * m:
  a, b = map(int, sys.stdin.readline().split())
  s = sum(map(get_bits, map(int, sys.stdin.readline().split())))
  for t in range(1 << n):
    if (dp[t] == -1):
      continue
    dp[t | s] = min(dp[t | s], dp[t] + a)

print(dp[-1] if dp[-1] != INF else -1)
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
tmp=0
ans=0
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)
sa = list(input())
sb = list(input())
sc = list(input())

d = sa[0]

while (len(sa) == 0 or len(sb) == 0 or len(sc) == 0) == 0:
    if d == 'a':
        sa = sa[1::]
        d = sa[0]
    elif d == 'b':
        sb = sb[1::]
        d = sb[0]
    else:
        sc = sc[1::]
        d = sc[0]

if len(sa) == 0:
    print('A')
elif len(sb) == 0:
    print('B')
else:
    print('C')

### FIXED CODE ###

sa = list(input())
sb = list(input())
sc = list(input())

d = 'a'
cnta = 0
cntb = 0
cntc = 0
A = len(sa)
B = len(sb)
C = len(sc)

while 1:
    if d == 'a':
        cnta += 1
        if cnta == A+1:
            print('A')
            break
        d = sa.pop(0)
    elif d == 'b':
        cntb += 1
        if cntb == B+1:
            print('B')
            break
        d = sb.pop(0)
    else:
        cntc += 1
        if cntc == C+1:
            print('C')
            break
        d = sc.pop(0)
import heapq

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

N, M = cin()
A = cin()
B = []
for i in range(M):
    in1 = cin()
    B.append(in1)
B = sorted(B, key = lambda x: x[1])

heapq.heapify(A)
cnt = 0
for i in range(M):
    for _ in range(B[i][0]):  heapq.heappush(A, max(heapq.heappop(A), B[i][1]))
    cnt += B[i][0]
    if cnt >= N:  break
print(sum(A))

### FIXED CODE ###

import heapq

N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for i in range(M)]
B = sorted(B, key = lambda x: x[1])[::-1]

heapq.heapify(A)
cnt = 0
for i in range(M):
    for _ in range(B[i][0]):  heapq.heappush(A, max(heapq.heappop(A), B[i][1]))
    cnt += B[i][0]
    if cnt >= N:  break
print(sum(A))
if a<b:
	if a<c and c<b:
		print("Yes")
	else:
		print("No")
elif b<a:
	if b<c and c<a:
		 print("Yes")
	else:
		 print("No")
else:
	 print("No")


### FIXED CODE ###

a,b,c=map(int,input().split())
if a<b:
	if a<c and c<b:
		print("Yes")
	else:
		print("No")
elif b<a:
	if b<c and c<a:
		 print("Yes")
	else:
		 print("No")
else:
	 print("No")
import numpy as np
import copy

H, W, K = input().split(' ')
H = int(H)
W = int(W)
K = int(K)
c = [list(str(input())) for i in range(H)]
cnp = np.array(c)

countAll = np.count_nonzero(cnp == '#')
countH = []
countW = []
for i in range(H):
    countH.append(np.count_nonzero(cnp[i] == '#'))
for i in range(W):
    countW.append(np.count_nonzero(cnp[:, i] == '#'))

ans = 0
for i in range(2 ** H - 1):
    for j in range(2 ** W - 1):
        tmp = copy.deepcopy(countAll)
        tmp2 = []
        choiceH = format(i, '0' + str(H) + 'b')
        for m in range(len(choiceH)):
            if int(choiceH[m]):
                tmp -= countH[m]
                tmp2.append(m)
        choiceW = format(j, '0' + str(W) + 'b')
        for n in range(len(choiceW)):
            if int(choiceW[n]):
                tmp -= countW[n]
                for o in range(len(tmp2)):
                    if cnp[tmp2[o], n] == '#':
                        tmp += 1
        if tmp == K:
            ans += 1

print(ans)

### FIXED CODE ###

import numpy as np

H, W, K = input().split(' ')
H = int(H)
W = int(W)
K = int(K)
c = [list(str(input())) for i in range(H)]
cnp = np.array(c)

countAll = np.count_nonzero(cnp == '#')
countH = []
countW = []
for i in range(H):
    countH.append(np.count_nonzero(cnp[i] == '#'))
for i in range(W):
    countW.append(np.count_nonzero(cnp[:, i] == '#'))

ans = 0
for i in range(2 ** H - 1):
    for j in range(2 ** W - 1):
        tmp = countAll
        tmp2 = []
        choiceH = format(i, '0' + str(H) + 'b')
        for m in range(len(choiceH)):
            if int(choiceH[m]):
                tmp -= countH[m]
                tmp2.append(m)
        choiceW = format(j, '0' + str(W) + 'b')
        for n in range(len(choiceW)):
            if int(choiceW[n]):
                tmp -= countW[n]
                for o in range(len(tmp2)):
                    if cnp[tmp2[o], n] == '#':
                        tmp += 1
        if tmp == K:
            ans += 1

print(ans)
n = int(input())
for i in range(1, n+1):
 if i%3 == 0:
  str +=" " + str(i)
 elif i%10 == 3:
  str +=" " + str(i)
 div = i
 while div//10:
  div = div//10
  if div%10 == 3:
   str +=" " + str(div)
   div = 0
print(str)

### FIXED CODE ###

n = int(input())
ans = ''
for i in range(1, n+1):
 if i%3 == 0:
  ans += " " + str(i)
 elif i%10 == 3:
  ans += " " + str(i)
 else:
  div = i
  while div//10:
   div = div//10
   if div%10 == 3:
    ans += " " + str(i)
    div = 0
print(ans)
a,b,c,d,e,f = map(int, input().split())
max_a = a * 100 * e * 10 ** (-2)
max_b = b * 100 * e * 10 ** (-2)

sugar_a = [0]
sugar_b = [0]
for i in range(100):
    for j in range(100):
        sugar_check = c * i + d * j
        if a * 100 + sugar_check <= f:
            sugar_a.append(sugar_check)
        if b * 100 + sugar_check <= f:
            sugar_b.append(sugar_check)
            
sugar_sort_a = sorted(list(set(sugar_a)))
sugar_sort_b = sorted(list(set(sugar_b)))

from bisect import bisect_left,bisect_right
if sugar_sort_a == [0]:
    sugar_max_a = 0
else:
    sugar_max_a = sugar_sort_a[bisect_left(sugar_sort_a, max_a)]
a_check = sugar_max_a / (a* 100 + sugar_max_a)

if sugar_sort_b == [0]:
    sugar_max_b = 0
else:
    sugar_max_b = sugar_sort_b[bisect_left(sugar_sort_b, max_b)] 
b_check = sugar_max_b / (b*100 + sugar_max_b)

if a_check >= b_check:
    print(a*100+sugar_max_a, sugar_max_a)
if a_check < b_check:
    print(b*100+sugar_max_b, sugar_max_b)

### FIXED CODE ###

a,b,c,d,e,f = map(int, input().split())
water_list = []
for i in range(f+1):
    for j in range(f+1):
        water = a * 100 * i + b * 100 * j
        if water <= f:
            water_list.append(water)
        else:
            break
            
sugar_list = []
for i in range(f+1):
    for j in range(f+1):
        sugar = c * i + d * j
        if sugar <= f:
            sugar_list.append(sugar)
        else:
            break
            
ans = []
for i in list(set(water_list)):
    for j in list(set(sugar_list)):
        if i != 0:
            if float(j) / i  <= e / 100 and (i + j) <= f:
                ans.append((i+j, j))
                
ans_sorted = sorted(ans, key=lambda x: (x[1] / (x[0])))[-1]
print(ans_sorted[0],ans_sorted[1])
from collections import deque

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

for i in range(n - 1):
    a, b = map(int, input().split())
    graph[a].append([b, i])
    graph[b].append([a, i])

ans = [0] * (n - 1)

q = deque([[1, 0, 0]])a

while q:
    node, pcol, p_node = q.popleft()
    cnt = 1
    for n_node in graph[node]:
        if n_node[0] == p_node:
            continue
        if cnt == pcol:
            cnt += 1
        ans[n_node[1]] = cnt
        q.append([n_node[0], cnt, node])
        cnt += 1

print(max(ans))
print(*ans, sep="\n")


### FIXED CODE ###

from collections import deque

n = int(input())
graph = [[] for _ in range(n)]

for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append([b, i])
    graph[b].append([a, i])

ans = [0] * (n - 1)

q = deque([[1, 0, -1]])

while q:
    node, pcol, p_node = q.popleft()
    cnt = 1
    for n_node in graph[node]:
        if n_node[0] == p_node:
            continue
        if cnt == pcol:
            cnt += 1
        ans[n_node[1]] = cnt
        q.append([n_node[0], cnt, node])
        cnt += 1

print(max(ans))
print(*ans, sep="\n")
import itertools

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

ans = 0

for k in range(K, N):
  ans += len(set(map(sum, itertools.combinations(range(N), k))))

print(ans%(10000000000+7)

### FIXED CODE ###

N, K = map(int, input().split())
 
ans = 0
mod = pow(10,9)+7
 
for k in range(K, N+2): ## K個以上で総数(N+1)
  ## 全個数の計算　## k個最大 ## k個最小
  ans += k*((N+1-k)+N)//2 - k*(0+k-1)//2 + 1
  
print(ans % mod)


## sum(range(N-k+1, N+1))
## k*((N+1-k)+N)/2

## sum(range(0, k))
## k*(0+k-1)/2
# 高速版input
import sys
input = sys.stdin.readline

# 二分探索
import bisect
import numpy as np

n,m = (int(i) for i in input().split())
a = sorted([int(i) for i in input().split()])
bc = [[int(i) for i in input().split()] for i in range(m)]

a = a
for b,c in bc:
    idx = bisect.bisect_left(a,c)
    a = (a[:idx] + [c]*b + a[idx:])[b:]

print(sum(a))

### FIXED CODE ###

# 高速版input
import sys
input = sys.stdin.readline

n,m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = [[int(i) for i in input().split()] for i in range(m)]

x = []
for b,c in sorted(bc, key=lambda x: x[1], reverse=True):
    x.extend([c]*b)
    if len(x) > n:
        break
        
a.extend(x)
print(sum(sorted(a,reverse=True)[:n]))
lst = list(map(int, input().split())).sort()

mval = lst[-1]
sval = sum(lst)
cn = mval + (sval-mval) % 2
n = (cn * 3 - sval) // 2
print(n)



### FIXED CODE ###

import numpy as np

# A, B, C = [11, 12, 15]
A, B, C = list(map(int, input().split()))


vals = np.array([A, B, C])
vals = np.sort(vals)

sumval = vals.sum()



cn = vals[-1] + np.sum(vals[:2]) % 2

n = (3 * cn - sumval) // 2

print(n)
N = int(input())
#print(N)
card = list(map(int, input().split()))
#print(card)

for i in range(N):
    v = card[i]
    j = i - 1
    while j >= 0 and card[j] > v:
        card[j+1] = card[j]
        j = j -1
    card[j+1] = v
    #print(card)
    card_str = ""
    
    for k in range(N-1):
        card_str += str(card[k])
        card_str += " "
    card_str += str(card[k+1])
    print(card_str)

### FIXED CODE ###

N = int(input())
#print(N)
card = list(map(int, input().split()))
#print(card)

for i in range(N):
    v = card[i]
    j = i - 1
    while j >= 0 and card[j] > v:
        card[j+1] = card[j]
        j = j -1
    card[j+1] = v
    #print(card)
    card_str = ""
    
    for k in range(N):
        card_str += str(card[k])
        card_str += " "
    
    print(card_str[:-1])
S=input()
a=0
for i in S:
  if i==='+':
    a+=1
  else:
    a-=1
print(a)
    

### FIXED CODE ###

S=input()
a=0
for i in S:
  if i=='+':
    a+=1
  else:
    a-=1
print(a)
import math
pi=math.pi
r=int(input())
len=2*pi*r
return len


### FIXED CODE ###

import math
pi=math.pi
r=int(input())
len=2*pi*r
print(len)
def main():
    target = int(input())
    cost = [101, 102, 103, 104, 105]
    answer = False
    for i in range(32):
        choice = bin(i)[2:].zfill(5)
        result = 0
        for j in range(5):
            result += cost[j] * int(choice[j])
        if (result % 100) % (target % 100) == 0 and result <= target:
            answer = True
            break
    print(1 if answer else 0)


if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    target = int(input())
    answer = False
    for i in range(1, 1001):
        if i * 100 <= target <= i * 105:
            answer = True
            break
    print(1 if answer else 0)


if __name__ == '__main__':
    main()
N,A,B,C,D=map(int,raw_input().split());Z=[1]+[0]*N;M=10**9+7;I=[1,1];F=I+[];R=I+[]
for i in range(2,N+1):I+=[(M-M/i)*I[M%i]%M];F+=[i*F[-1]%M];R+=[I[i]*R[-1]%M]
for i in range(A,B+1):Z=[(Z[j]+sum(Z[j-i*k]*F[N-j+i*k]*R[N-j]*pow(R[i],k,M)*R[k]for k in range(C,min(D,j/i)+1)))%M for j in range(N+1)]
print Z[N]

### FIXED CODE ###

N,A,B,C,D=map(int,input().split());Z=[1]+[0]*N;M=10**9+7;I=[1,1];F=I+[];R=I+[]
for i in range(2,N+1):I+=[(M-M//i)*I[M%i]%M];F+=[i*F[-1]%M];R+=[I[i]*R[-1]%M]
for i in range(A,B+1):Z=[(Z[j]+sum(Z[j-i*k]*F[N-j+i*k]*R[N-j]*pow(R[i],k,M)*R[k]for k in range(C,min(D,j//i)+1)))%M for j in range(N+1)]
print(Z[N])
N=int(input())
price=[]
for i in range(N):
    price.append(int(input()))
price.sort(reverse=True)
price[0]=price[0]//2
sum(price)


### FIXED CODE ###

D=input()
if D=='25':
  print('Christmas')
elif D=='24':
  print('Christmas Eve')
elif D=='23':
  print( 'Christmas Eve Eve')
elif D=='22':
  print('Christmas Eve Eve Eve')
import numpy as np

a, b, c = map(int, input().split())
print("Yes" if np.sqrt(a) + np.sqrt(b) < np.sqrt(c) else "No")

### FIXED CODE ###

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[int(input())-1])
from bisect import bisect
n = int(input())
a = [int(x) for x in input().split()]

r = 0
s = []
for i in a:
  r += i
  s.append(r)

def bs(x,y):
  b = bisect(x, y)
  if abs(x[b-1] - y) < abs(x[b] - y):
    b = b-1
  return b

m = 10**20
for i in range(2, n-1):
  k = bs(s, s[i] / 2)
  l = bs(s, (s[n] + s[i]) / 2)
  s4 = [s[k],s[i]-s[k],s[l]-s[i],s[n]-s[l]]
  m = min(m, max(s4) - min(s4))

print(m)

### FIXED CODE ###

from bisect import bisect
n = int(input())
a = [int(x) for x in input().split()]
 
r = 0
s = []
for i in a:
  r += i
  s.append(r)

def bs(x,y):
  b = bisect(x, y)
  if abs(x[b-1] - y) < abs(x[b] - y):
    b = b-1
  return b
 
m = 10**20
for i in range(1, n-1):
  k = bs(s, s[i] / 2)
  l = bs(s, (s[n-1] + s[i]) / 2)
  s4 = [s[k],s[i]-s[k],s[l]-s[i],s[n-1]-s[l]]
  m = min(m, max(s4) - min(s4))

print(m)
n=int(input())
l=list(map(int,input().split()))

sum_l=sum(l)

sum=0
a=0
for i in range(n):
  sum+=l[i]
  if sum>sum_l/2:
    a=i-1
    break
    
ans=abs(sum(l[:a])-sum(l[a:]))
print(ans)

### FIXED CODE ###

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

ans=[]
left=0
right=0

for i in range(n):
  left=sum(l[:i+1])
  right=sum(l[i+1:])
  ans.append(abs(left-right))
  
print(min(ans))
def noboru(i, a2, a1):
    if (i == 1):
        return a1
    elif (i == 2):
        return a2
    else:
        return noboru(i-1, a2+a1, a2)


def func(N, M, a):
    ans = 1
    i = 0
    if (a[0] == 1):
        ans *=1
    else:
        ans *= noboru(a[0]-1,2,1)
    if (M > 1):
        for i in range(1, M):
            if (a[i] == a[i-1]+1):
                return 0
            else:
                ans *= noboru(a[i] - a[i-1] -2,2,1)
    ans *= noboru(N - a[i] -1,2,1)
    return ans

N, M = map(int, input().split(" "))
a = [int(input()) for _ in range(M)]
print(func(N, M, a) % 1000000007)

### FIXED CODE ###

CONST = 1000000007

def noboru(n):
    a1 = 1
    a2 = 2
    ans = 0
    if (n == 0 or n == 1): return a1
    elif (n == 2): return a2
    else:
        for i in range(1, n-1):
            ans = a2 + a1
            a1 = a2
            a2 = ans
        return a2

def func(N, M, a):
    ans = 1
    pos = 0
    for i in range(M):
        if (pos == a[i]):
            return 0
        else:
            ans = (ans * noboru(a[i] - pos - 1)) % CONST
            pos = a[i] + 1
    ans = (ans * noboru(N - pos)) % CONST
    return ans

N, M = map(int, input().split(" "))
a = [int(input()) for _ in range(M)]
print(func(N, M, a))
a,b = map(str,input().split())
a = int(a)
b1,b2 = map(int,b.split("."))
ans = a* (b1 * 100 + b2)
print(ans//100)


### FIXED CODE ###

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