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 Python (3.8.2) (judge verdict: Time Limit Exceeded)

import numpy as np
from numba import njit


def comb(n, r, p):
    r = min(r, n - r)
    ret = fac[n]
    ret = ret * facinv[r] % p
    return ret * facinv[n - r] % p


@njit
def comb_init(N_UNTIL, p):
    N_UNTIL += 1
    inv = np.empty(N_UNTIL, np.int64)
    fac = np.empty(N_UNTIL, np.int64)
    facinv = np.empty(N_UNTIL, np.int64)
    inv[0] = 0
    inv[1] = 1
    fac[0] = 1
    facinv[0] = 1
    for i in range(2, N_UNTIL):
        inv[i] = -inv[p % i] * (p // i) % p
    for i in range(1, N_UNTIL):
        fac[i] = fac[i - 1] * i % p
    for i in range(1, N_UNTIL):
        facinv[i] = facinv[i - 1] * inv[i] % p
    return inv, fac, facinv


K = int(input())
S = input()
N = len(S)
MOD = 1_000_000_007
inv, fac, facinv = comb_init(N + K - 1, MOD)
ans = 0
for i in range(K + 1):
    tmp = pow(25, K - i, MOD)
    tmp *= comb(N + K - i - 1, K - i, MOD)
    tmp %= MOD
    tmp *= pow(26, i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)