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 <bits/stdc++.h>
using namespace std;
const long long m = 1e9+7;
const long long maxn = 2e6+1;
long long fact[maxn];
int k, n;
string s;

int bigmod(int a, int b) 
{
    if(b == 0) return 1 % m;
    int x = bigmod(a, b/2);
    x = (long long) x * x % m;
    if(b&1) x = (long long) x * a % m;
    return x;
}


int comb(int n, int r) {
    if(n < 0 || r < 0) return 0;
    if(n < r) return 0;
    int ans = (long long) ((long long) fact[n] * bigmod(fact[r], m-2) % m) * bigmod(fact[n-r], m-2) % m;
    return ans;
}

int main()
{
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= maxn-1; i++) fact[i] = (long long) fact[i-1] * i % m;
    
    cin >> k >> s;
    n = (int)s.size()-1;
    int ans = 0;
    for(int i = n; i <= n+k; i++) {
        ans = (ans + (long long) ((long long) comb(i,n) * (bigmod(26, (n+k)-i)) % m) * bigmod(25, (i-n)) % m) % m;
    }

    cout << ans << "\n";

    return 0;
}