Problem:
Score: 600 points

Problem Statement

How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"?

The answer can be enormous, so print it modulo (10^9+7).

Constraints

K is an integer between 1 and 10^6 (inclusive).

S is a string of length between 1 and 10^6 (inclusive) consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

K
S

Output

Print the number of strings satisfying the condition, modulo (10^9+7).

Sample Input 1

5
oof

Sample Output 1

575111451

For example, we can obtain proofend, moonwolf, and onionpuf, while we cannot obtain oofsix, oofelevennn, voxafolt, or fooooooo.

Sample Input 2

37564
whydidyoudesertme

Sample Output 2

318008117

Solution in PyPy3 (7.3.0) (judge verdict: Time Limit Exceeded)

MOD = int(10e9+7)
maxn = int(10e6+10)

def mod(x, m = MOD):
    tmp = x%m 
    if(tmp < 0): tmp += m 
    return tmp

def fpow(x, y, m = MOD):
    res = 1
    while(y):
        if y%2:
            res =  mod(res*x)
        y>>=1
        x = mod(x*x)
    return res

fat = [1]
ifat = [1]
power25 = [1]

for i in range(1,maxn):
    fat.append(mod(fat[i-1]*i))
    power25.append(mod(25*power25[i-1]))
    ifat.append(fpow(fat[i], MOD - 2))

def comb(n, k):
    return mod(mod(fat[n] * ifat[n-k]) * ifat[k])

k = int(input())
s = input()
n = len(s) + k 

ans = fpow(26,n)

for m in range(0,len(s)):
    tmp = mod(power25[n-m]*comb(n,m))
    ans = mod(ans-tmp)

print(ans)