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 perm(ll n, ll r){
    ll res = 1;
    for(ll i=0;i<r;i++){
        res = mod(res*(n-i));
    }
    return res;
}

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 fact[1000000*2] = {1};
ll factinv[1000000*2] = {1};
ll conb(ll n, ll r){
    return mul3(fact[n], factinv[r], factinv[n-r]);
}

ll pow25[1000000*2] = {1};
ll pow26[1000000*2] = {1};


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;
    }

    for(ll i=1;i<K+s_len;i++){
        fact[i] = mod(fact[i-1]*i);
        factinv[i] = inv(fact[i]);
        pow25[i] = mod(pow25[i-1]*25);
        pow26[i] = mod(pow26[i-1]*26);
    }
    
    ll ans = 0;
    for(ll i=K;i>=0;i--){
        ll t = mul3(conb(s_len+i-1, i), modpow(25, i), modpow(26, K-i));
        ans = mod(ans + t);
    }
    printf("%lld\n", ans);

    return 0;
}