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 C (GCC 9.2.1) (judge verdict: Accepted)

#include <stdio.h>
#include <stdlib.h>

#define ll long long
#define MD 1000000007
#define mod(n) ((n%MD+MD)%MD)
#define max(x, y) (x>y? x : y)
#define min(x, y) (x<y? x : y)
#define mul3(x, y, z) (mod(mod(x*y)*z)) 

ll modpow(ll x, ll y){
    ll res = 1;
    while(y>0){
        if(y&1) res = mod(res*x);
        x = mod(x*x);
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return modpow(n, MD-2);
}

ll memo_fact[1000000*2] = {0};
ll fact(ll n){
    if(memo_fact[n]) return memo_fact[n];
    ll m = n;
    memo_fact[0] = 1;
    while(memo_fact[m]==0) m--;
    for(ll i=m+1;i<=n;i++) memo_fact[i] = memo_fact[i-1]*i%MD;
    return memo_fact[n];
}

ll comb(ll n, ll r){
    return mul3(fact(n), inv(fact(r)), inv(fact(n-r)));
}


int main(){
    ll K;
    char S[1000000];
    scanf("%lld%s", &K, S);
    // end input

    ll s_len = 0;
    for(;s_len<(ll)1e6;s_len++){
        if(!S[s_len]) break;
    }

    ll ans = 0;
    for(ll i=K;i>=0;i--){
        ll t = mul3(comb(s_len+i-1, i), modpow(25, i), modpow(26, K-i));
        ans = mod(ans + t);
    }
    printf("%lld\n", ans);

    return 0;
}