Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
input=sys.stdin.readline

#区間[L,R]に1を加えていく
def seg_tree_update(L,R):
    L,R=2**m-1+L,2**m-1+R
    while L<R:
        if L%2==0:
            tree[L]+=1
        if R%2==1:
            tree[R]+=1
        L//=2
        R=R//2-1
    if L==R:
        tree[L]+=1

#数直線xでの和を求める
def seg_tree_sumarize(x):
    ind=2**m-1+x
    SUM=0
    while ind>=0:
        SUM+=tree[ind]
        ind=(ind-1)//2
    return SUM

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

data=[]

for i in range(N):
    l,r=map(int,input().split())
    data.append([r-l, l, r])

data.sort()

m=0
while pow(2,m)<M+1:
    m+=1
tree=[0]*(pow(2,m+1)-1)

i=0
for d in range(1,M+1):
    
    #間隔の長さがd以下の区間だけ考えれば良い。
    while i<N and data[i][0]<d:
        seg_tree_update(data[i][1],data[i][2])
        i+=1
    
    ans=0
    
    for j in range((M+1)//d+1):
        if d*j>M:
            break
        ans+=seg_tree_sumarize(d*j)
    
    print(ans+N-i)

### FIXED CODE ###

"""
BIT
区間[L,R]にxを加える。
座標Xでの値を求める。
"""
import sys
input=sys.stdin.readline

def bit_add(i,x):
    while i<=M:
        tree[i]+=x
        i+=i&(-i)

def bit_sum(i):
    s=0
    while i>0:
        s+=tree[i]
        i-=i&(-i)
    return s

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

data=[]
for i in range(N):
    l,r=map(int,input().split())
    data.append([r-l, l, r])
data.sort()

k=0
tree=[0]*(M+1)
for d in range(1,M+1):
    
    #間隔の長さがd以下の区間だけ考えれば良い。
    while k<N and data[k][0]<d:
        bit_add(data[k][1],1)
        bit_add(data[k][2]+1,-1)
        k+=1
    
    ans=0
    for j in range(1,M//d+1):
        ans+=bit_sum(d*j)
    
    print(ans+N-k)
### BUGGY CODE ###

import math

#Input
H, N = map(int, input().split())
lstV = list()
lstC = list()
for i in range(N):
    value, cost = map(int, input().split())
    lstV.append(value)
    lstC.append(cost)

#DPMap
dp = list([2**31-1]*(H + max(lstV)))
dp[0] = 0
for i in range(0,len(dp)):
    for j in range(0,len(lstV)):
        value = lstV[j]
        cost = lstC[j]
        if i + value <= len(dp) - 1:
            dp[i + value] = min(dp[i + value], dp[i] + cost)
print(min(dp[H:]))

### FIXED CODE ###

H, N = map(int, input().split())
AB = list(list(map(int, input().split())) for _ in range(N))

def main2(H, N, AB):
    inf = 2**31 -1
    dp = [inf] * (H + max(a for a, _ in AB))
    dp[0] = 0
    for i in range(1, len(dp)):
        dp[i] = min(dp[i-a]+b for a,b in AB)
    print(min(dp[H:]))

main2(H,N,AB)
### BUGGY CODE ###

N = int(input())
a = sorted([int(x) for x in input().split()])
i,ans = 0,0
while i < N:
    c = a.count(a[i])
    if c > a[i]:
        ans += c-a[i]
    elif c < a[i]:
        ans += c
    i += c

print(ans)



### FIXED CODE ###

N = int(input())
a = sorted([int(x) for x in input().split()])
i,ans = 0,0
while i < N:
    if a[i] > N:
        ans += N-i
        break
    c = a.count(a[i])
    if c > a[i]:
        ans += c-a[i]
    elif c < a[i]:
        ans += c
    i += c

print(ans)
### BUGGY CODE ###

n,k = map(int,input().split())
a = [0] + list(map(int,input().split())) #1_indexed
tele = [1]
appear = []
while True:
    next_number = a[tele[len(tele)-1]]
    if not next_number in appear:
        tele.append(next_number)
        appear.append(next_number)
    else:
        repeat = tele.index(next_number)
        tele_1 = tele[:repeat]
        tele_2 = tele[repeat:]
        break

if k < len(tele_1):
    print(tele_1[k])
else:
    k_new = (k-len(tele_1)+1) % len(tele_2)
    print(tele_2[k_new-1])

### FIXED CODE ###

n,k = map(int,input().split())
a = [0] + list(map(int,input().split())) #1_indexed
tele = [1]
used = [False for i in range(n)]
while True:
    next_number = a[tele[len(tele)-1]]
    if not used[next_number-1]:
        tele.append(next_number)
        used[next_number-1] = True
    else:
        repeat = tele.index(next_number)
        tele_1 = tele[:repeat]
        tele_2 = tele[repeat:]
        break

if k < len(tele_1):
    print(tele_1[k])
else:
    k_new = (k-len(tele_1)+1) % len(tele_2)
    print(tele_2[k_new-1])
### BUGGY CODE ###

N=int(input())
P=list(map(int,input().split()))
ans=0
for i,p in enumerate(P,1):
    if min(P[:i])==p:
        ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
P=map(int, input().split())
ans=0
mv=N
for p in P:
    if p<=mv:
        ans+=1
        mv=p
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
dp = [0 for i in range(n)]
dp[0] = a[0]
length = 1
for i in range(1, n):
    if dp[length-1] < a[i]:
        dp[length] = a[i]
        length += 1        
    else:
        for j in range(length):
            if dp[j] >= a[i]:
                dp[j] = a[i]
                break
print(length)


### FIXED CODE ###

from bisect import bisect_left
n = int(input())
a = [int(input()) for i in range(n)]
dp = [0 for i in range(n)]
dp[0] = a[0]
length = 1
for i in range(1, n):
    if dp[length-1] < a[i]:
        dp[length] = a[i]
        length += 1        
    else:
        dp[bisect_left(dp[:length],a[i])] = a[i]
print(length)
### BUGGY CODE ###

n = input()
s = 0
while n > 0:
	n -= 1
	a = input()
	if sum(map(lambda x: a%x==0, range(1, int(a**0.5)+1))) == 1:
		s += 1
print s

		

### FIXED CODE ###

n = input()
s = 0
while n > 0:
	n -= 1
	a = input()
	if a == 1:
		pass
	elif a == 2:
		s += 1
	elif (a%2 == 1):
		for i in xrange(3, (int(a**0.5)+1), 2):
			if a%i==0:
				break	
		else:
			s += 1		
print s
### BUGGY CODE ###

data = {}
N = int(input())

for a in input().split():
    a = int(a)
    data[a] = data.get(a, 0) + 1

Q = int(input())

for _ in range(Q):
    b, c = map(int, input().split())
    if data.get(b):
        data[c] = data.get(c, 0) + data.pop(b)
    print(sum([k * v for k, v in data.items()]))

### FIXED CODE ###

data = {}
total = 0
N = int(input())

for a in input().split():
    a = int(a)
    data[a] = data.get(a, 0) + 1
    total += a

Q = int(input())

for _ in range(Q):
    b, c = map(int, input().split())
    diff = c - b
    count = data.get(b)
    if count:
        data[c] = data.get(c, 0) + data.pop(b)
        total += diff * count
    print(total)
### BUGGY CODE ###

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

p = [0]*M
s = [0]*M
b = [0]*N
pena = 0
corr = 0

for i in range(N):
    b[i] = []

for i in range(M):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
    if not (set(b[p[i]-1]) & {"AC"}):
        if s[i] == "AC":
            pena += len(b[p[i]-1])
            corr += 1
    b[p[i]-1].append(s[i])

print(corr, pena)


### FIXED CODE ###

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

p = [0]*M
s = [0]*M
b = [0]*N
pena = 0
corr = 0

for i in range(M):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
    if b[p[i]-1] != -1:
        if s[i] == "AC":
            pena += b[p[i]-1]
            corr += 1
            b[p[i]-1] = -1
        else:
            b[p[i]-1] += 1

print(corr, pena)
### BUGGY CODE ###

import sys
import fractions
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7


ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

cnt=0
for i in range(n):
    cnt+=ans//a[i]
    cnt%=mod
print(cnt)

### FIXED CODE ###

import sys
from collections import deque
import heapq
import math
import bisect
from itertools import permutations
from itertools import accumulate
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

dic={}
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# print(factorization(12))
for i in range(n):
    tmp=factorization(a[i])
    for j in range(len(tmp)):
        if not tmp[j][0] in dic:
            dic[tmp[j][0]]=tmp[j][1]
        else:
            dic[tmp[j][0]]=max(dic[tmp[j][0]],tmp[j][1])
l=1
for i in dic.keys():
    l*=i**dic[i]
    l%=mod
# print(l)
ans=0
for i in range(n):
    ans+=l*pow(a[i],mod-2,mod)
    ans%=mod
print(ans)
### BUGGY CODE ###

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

ans = 1
flag = True
for a in A:
    ans *= a
if ans > 10**18:
    flag = False
if flag:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

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

ans = 1
flag_over = False
flag_0 = False
len0 = 0

if 0 in A:
    flag_0 = True
for b in B:
    len0 += len(b) - 1
if len0 > 18:
    flag_over = True

if flag_0 == False and flag_over == 0:
    for a in A:
        ans *= a

if ans > 10**18:
    flag_over = True

if flag_0:
    print(0)
elif flag_over:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    P = list(map(int, input().split()))

    ans = 1
    for i in range(1, N):
        if min(P[:i]) >= P[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    P = list(map(int, input().split()))

    ans = 1
    m = P[0]
    for i in range(1, N):
        if P[i - 1] < m:
            m = P[i - 1]
        if m >= P[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

k,s=map(int,input().split())
print([x+y+z for x in range(k+1) for y in range(k+1) for z in range(k+1)].count(s))


### FIXED CODE ###

k,s = map(int, input().split())
cnt=0
for x in range(k+1):
  for y in range(k+1):
    z = s-x-y
    if 0<=z and z<=k:
      cnt+=1
print(cnt)
### BUGGY CODE ###

import sys

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

for i in range(1,m):
  if a[i]-a[i-1]==1:
    print(0)
    sys.exit()
if 1 in a:
  nlist.append(0)
  nlist.append(1)
elif 2 in a:
  nlist.append(1)
  nlist.append(0)
else:
  nlist.append(1)
  nlist.append(2)

for i in range(2,n):
  if i+1 in a:
    nlist.append(0)
  else:
    nlist.append((nlist[i-1]+nlist[i-2])%1000000007)
print(nlist[n-1]%1000000007)

### FIXED CODE ###

import sys

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
nlist=[]
analist=[0]*n
#O(N^2)を防ぐために、穴判定用配列作る
for i in range(m):
  analist[a[i]-1]="ana"

for i in range(1,m):
  if a[i]-a[i-1]==1:
    print(0)
    sys.exit()
if 1 in a:
  nlist.append(0)
  nlist.append(1)
elif 2 in a:
  nlist.append(1)
  nlist.append(0)
else:
  nlist.append(1)
  nlist.append(2)

for i in range(2,n):
  if analist[i]=="ana":
    nlist.append(0)
  else:
    nlist.append((nlist[i-1]+nlist[i-2])%1000000007)
print(nlist[n-1]%1000000007)
### BUGGY CODE ###

N, K = [int(i) for i in input().split()]
HS = [int(i) for i in input().split()]

dp = [float('inf')]*N

dp[0] = 0
dp[1] = abs(HS[1] - HS[0])

for i in range(2, N):
  dp[i] = min([dp[i-k] + abs(HS[i] - HS[i-k]) for k in range(1, K + 1)])

print(dp[N-1])


### FIXED CODE ###

N, K = [int(i) for i in input().split()]
HS = [int(i) for i in input().split()]

dp = [float('inf')]*N

dp[0] = 0
dp[1] = abs(HS[1] - HS[0])

for i in range(2, N):
  dp[i] = min([dp[i-k] + abs(HS[i] - HS[i-k]) for k in range(1, K + 1)])

print(dp[N-1])
### BUGGY CODE ###

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

left = A+K-1
right = B-K+1

if left < right:
    l1 = [i for i in range(A, B + 1) if i <= left or right <= i ]
else:
    l1 = [i for i in range(A, B+1)]

for i in l1:
    print(i)



### FIXED CODE ###

A, B, K = map(int, input().split())
if B-A+1 >= 2*K: # A以上B以下の整数の数が2K以上
    res_list = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
else: # A以上B以下の整数の数が2K未満
    res_list = [i for i in range(A, B+1)]
for i in res_list:
    print(i)
### BUGGY CODE ###

N,M,Q = map(int,input().split())

train = [[0 for i in range(N)] for j in range(N)]
for m in range(M):
    L,R = map(int,input().split())
    train[L-1][R-1] += 1

c = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    cnt = 0
    for j in range(N):
        cnt += train[i][j]
        c[i][j] = cnt

for x in range(Q):
    p,q = map(int,input().split())
    p -= 1
    q -= 1
    cnt2 = 0
    for i in range(p,q+1):
        if p == 0:
            cnt2 += c[i][q]
        else:
            cnt2 += c[i][q] - c[i][p-1]
    print(cnt2)



### FIXED CODE ###

N,M,Q = map(int,input().split())

train = [[0 for i in range(N)] for j in range(N)]
for m in range(M):
    L,R = map(int,input().split())
    train[L-1][R-1] += 1

c = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    cnt = 0
    for j in range(N):
        cnt += train[i][j]
        c[i][j] = cnt

for x in range(Q):
    p,q = map(int,input().split())
    p -= 1
    q -= 1
    cnt2 = 0
    for i in range(p,q+1):
        if p == 0:
            cnt2 += c[i][q]
        else:
            cnt2 += c[i][q] - c[i][p-1]
    print(cnt2)
### BUGGY CODE ###

a, b = map(int, input().split())
c = input()
for i in range(b):
    d, e = map(int, input().split())
    f = 0
    for j in range(d, e):
        if c[j-1] == "A" and c[j] == "C":
            f += 1
    print(f)


### FIXED CODE ###

a, b = map(int, input().split())
c = input()
d = [0] * a
e = 0
for i in range(1, a):
    if c[i] == "C" and c[i-1] == "A":
        e += 1
    d[i] = e
for i in range(b):
    f, g = map(int, input().split())
    print(d[g-1]-d[f-1])
### BUGGY CODE ###

import fractions
a,b,c,d = map(int,input().split())
count_c = 0
count_d = 0
count_cd = 0
count = 0
j = 1
g = c*d//fractions.gcd(c,d)
while(1):
    if c*j <= b and c*j>=a:
        count_c += 1
    if d*j <=b and d*j >= a:
        count_c += 1
    if g*j <=b and g*j >= a:
        count_cd += 1
    if c*j > b and d*j > b and g*j > b:
        break
    j += 1
s = count_c+count_d-count_cd
print(b-a +1-s)

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
count_c = 0
count_d = 0
count_cd = 0
count = 0
j = 1
g = c*d//fractions.gcd(c,d)

count_c = b//c - (a-1)//c
count_d = b//d - (a-1)//d
count_cd = b//g -(a-1)//g
count_s = count_c+count_d-count_cd
print(b-a+1-count_s)
### BUGGY CODE ###

n,a,b=map(int,input().split())
an=0

while 1:
    if n>a:
        n-=a
        an+=a
    else:
        print(an+n)
        exit()
    
    if n>b:
        n-=b
    else:
        print(an)
        exit()

### FIXED CODE ###

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

if a==0:
    print("0")
    exit()
elif b==0:
    print(n)
    exit()

t1=(n//(a+b))
t2=(n%(a+b))

if t2>a:
    print((t1*a)+a)
else:
    print((t1*a)+t2)
### BUGGY CODE ###

def inv(x):
    return pow(x, MOD-2, MOD)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

primes = {}

for val in A:
    p = 2
    while val >= p * p:
        if val % p == 0:
            # 割り切れるならそこから話が始まる
            cnt = 0
            while val % p == 0:
                cnt += 1
                val //= p
            if p not in primes:
                primes[p] = cnt
            else:
                primes[p] = max(cnt, primes[p])
        p += 1
    if val != 1:
        if val not in primes:
            primes[val] = 1

lcm = 1
for p in primes:
    lcm *= p ** primes[p]
    lcm %= MOD
# print(lcm)
ans = 0

for val in A:
    ans += lcm * inv(val)
    ans %= MOD
print(ans)


### FIXED CODE ###

def gcd(m, n):
    while n:
        m, n = n, m % n
    return m


def lcm(x, y):
        return (x*y) // gcd(x, y)


N = int(input())
A = list(map(int, input().split()))
A.sort()
lcm_value = A[0]
for i in range(1, N):
    lcm_value = lcm(lcm_value, A[i])

# print(lcm_value)
mod = 10**9+7
ans = 0
for i in range(N):
    ans += (lcm_value // A[i])

print(ans % mod)
### BUGGY CODE ###

import heapq
n, m= map(int, input().split())

links = []

sums = [0] * (n + 1)

for _ in range(n - 1):
  a, b= map(int, input().split())
  heapq.heappush(links, [a,b])

uppers = [[x] for x in range(n + 1)]
oya = {}
for l in links:
  # uppers[l[0]].append(l[1])
  oya[l[1]] = l[0]
  up = l[0]
  while True:
    if up not in oya:
      # print(up)
      uppers[up].append(l[1])
      break
    else:
      uppers[up].append(l[1])
      up = oya[up]
# print(uppers)
# print(oya)

for _ in range(m):
  p, x = map(int, input().split())
  for up in uppers[p]:
    sums[up] += x

print(*sums[1:])
  

### FIXED CODE ###

from collections import defaultdict

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

links = [[] for x in range(n + 1)]
sums = [0 for x in range(n + 1)]
adds = [0 for x in range(n + 1)]

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

for _ in range(m):
  p, x = map(int, input().split())
  adds[p] += x

# print(links)
que = [0,[1]]
checked = [0 for x in range(n+1)]

que = [[-1, [0]]]

while que:
  link = que.pop()
  # print(link)
  par = link[0]
  childs = link[1]

  for child in childs:
    if checked[child] != 1:
      sums[child] = sums[par] + adds[child]
      que.append([child, links[child]])
      checked[child] = 1

  
print(*sums[1:])
### BUGGY CODE ###

N=int(input())
listA=list(map(int,input().split()))
for i in range(1,N):
  ans=listA.count(i)
  print(ans)
print(0)

### FIXED CODE ###

import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
listA=set(listA)  
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)
### BUGGY CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
for i in range(m):
    b,c = map(int,input().split())
    index = 0
    for j in range(b):
        if a[j]<c:
            a[j]=c
    a.sort()

print(sum(a))

### FIXED CODE ###

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

bc =[]
for i in range(m):
    b,c = map(int,input().split())
    bc.append((b,c))

bc.sort(key=lambda x:x[1],reverse=True)
newcard=[]
for b,c in bc:
    newcard.extend([c]*b)
    if(len(newcard)>=n):
        break

size = min(n,len(newcard))
a.sort()
for i in range(size):
    if(newcard[i]>a[i]):
        a[i]=newcard[i]
    else:
        break
print(sum(a))
### BUGGY CODE ###



MOD = 10**9+7
factorial = [1]
inverse_factorial = [0]


def modpow(a, p):
    ans = 1
    while p:
        if p&1 == 1:
            ans = (ans*a)%MOD
        a = (a*a)%MOD
        p >>= 1
    return ans


def nCr(n, r):
    if r == 0 or r == n:
        return 1
    return (((factorial[n]*inverse_factorial[n-r])%MOD)*inverse_factorial[r])%MOD


def init_nCr(max_n):
    for i in range(1, 2*max_n+1):
        f = (factorial[-1]*i)%MOD
        factorial.append(f)
        inv_f = modpow(f, MOD-2)
        inverse_factorial.append(inv_f)


def pow(b, p):
    ans = 1
    for _ in range(p):
        ans = (ans*b)%MOD
    return ans


def pow_list(b, p):
    ans = [1]
    for _ in range(p):
        ans.append(ans[-1]*b)
    return ans


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    K = read_int()
    S = len(input().strip())
    init_nCr(K+S)
    T = pow(26, K+S)
    pow_25 = pow_list(25, K+S)
    for i in range(S):
        T = (T-nCr(K+S, i)*pow_25[K+S-i])%MOD
    return T


if __name__ == '__main__':
    print(solve())


### FIXED CODE ###



MOD = 10**9+7
factorial = [1]
inverse_factorial = [0]


def modpow(a, p):
    ans = 1
    while p:
        if p&1 == 1:
            ans = (ans*a)%MOD
        a = (a*a)%MOD
        p >>= 1
    return ans


def nCr(n, r):
    if r == 0 or r == n:
        return 1
    return (((factorial[n]*inverse_factorial[n-r])%MOD)*inverse_factorial[r])%MOD


def init_nCr(max_n):
    for i in range(1, max_n+1):
        f = (factorial[-1]*i)%MOD
        factorial.append(f)
        inv_f = modpow(f, MOD-2)
        inverse_factorial.append(inv_f)


def pow(b, p):
    ans = 1
    for _ in range(p):
        ans = (ans*b)%MOD
    return ans


def pow_list(b, p):
    ans = [1]
    for _ in range(p):
        ans.append((ans[-1]*b)%MOD)
    return ans


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    K = read_int()
    S = len(input().strip())
    init_nCr(K+S)
    T = pow(26, K+S)
    pow_25 = pow_list(25, K+S)
    for i in range(S):
        T = (T-(nCr(K+S, i)*pow_25[K+S-i])%MOD)%MOD
    return T


if __name__ == '__main__':
    print(solve())
### BUGGY CODE ###

# -*- coding: utf-8 -*-

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

# 予め組み合わせ計算に必要な階乗のテーブルを作っておく
factorials = [0] * (H+W)
factorials[0] = 1
factorials[1] = 1
for i in range(2,H+W):
    factorials[i] = factorials[i-1] * i
    
# 組み合わせの数だけ返してくれる関数(自作)
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorials[n]
    # 分母の計算
    denominator = factorials[r] * factorials[n-r]
    return numerator // denominator

h = H - A
w = B + 1
ans = 0
# マスを右上に1つずつずらして、必ず通る場所でパターンを足し合わせていく
while h > 0 and w <= W:
    ans = (ans + nCr(h+w-2, h-1) * nCr(H-h+W-w, H-h)) % (10 ** 9 + 7)
    h -= 1
    w += 1

print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-

H,W,A,B = map(int, input().split())
mod = (10 ** 9 + 7)

# 予め組み合わせ計算に必要な階乗と逆元のテーブルを作っておく
factorial = [0] * (H+W)
factorial[0] = 1
factorial[1] = 1
inverse = [0] * (H+W)
inverse[0] = 1
inverse[1] = 1
for i in range(2,H+W):
    factorial[i] = factorial[i-1] * i % mod
    # フェルマーの小定理から(x! ** mod-2 % mod == x! ** -1 % mod)
    # powに第三引数入れると冪乗のmod付計算を高速にやってくれる
    inverse[i] = pow(factorial[i], mod-2, mod)
    
# 組み合わせの数だけ返してくれる関数(自作)
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorial[n]
    # 分母の計算
    denominator = inverse[r] * inverse[n-r] % mod
    return numerator * denominator % mod

h = H - A
w = B + 1
ans = 0
# マスを右上に1つずつずらして、必ず通る場所でパターンを足し合わせていく
while h > 0 and w <= W:
    ans = (ans + nCr(h+w-2, h-1) * nCr(H-h+W-w, H-h)) % mod
    h -= 1
    w += 1

print(ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
  return sum(d)

for k in range(N):
  count[k]=f(k,A)

for i in range(len(count)):
  print(count[i])

### FIXED CODE ###

import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)
### BUGGY CODE ###

N = int(input())
*S, = map(int, input().split())

ans = 0
for a in range(1, N):
    d = 1
    while d*d <= N-1-a:
        if (N-1-a) % d == 0:
            if a > d and (a % d > 0 or N-1-a < a):
                k = (N-1-a) // d
                s = 0
                for i in range(k):
                    s += S[i*d+d] + S[i*d+a]
                ans = max(ans, s)
            e = (N-1-a) // d
            if a > e and (a % e > 0 or N-1-a < a):
                k = (N-1-a) // e
                s = 0
                for i in range(k):
                    s += S[i*e+e] + S[i*e+a]
                ans = max(ans, s)
        d += 1
print(ans)

### FIXED CODE ###

N = int(input())
*S, = map(int, input().split())

ans = 0
for d in range(1, N):
    r = k = 0
    while k*d <= N-1:
        a = N-1-k*d
        if a <= d or (a <= k*d and a % d == 0):
            break
        r += S[N-1-k*d] + S[k*d]
        k += 1
        ans = max(ans, r)
print(ans)