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: Time Limit Exceeded)

#include <bits/stdc++.h>
using namespace std;
long long MOD=1e9+7;
long long fac[2000005], inv[2000005];
long long modpow(long long x,long long e){
	if(x==1||e==0) return 1;
	long long c=modpow(x,e/2);
	long long c1=(c*c)%MOD;
	if(e%2==0) return c1;
	else return (c1*x)%MOD;
}
long long C(long long n, long long k){
	if(k>n || k<0) return 0;
	return ((fac[n]*inv[k])%MOD*inv[n-k])%MOD;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	fac[0]=inv[0]=1;
	for(int i=1;i<2000005;i++){
		fac[i]=(fac[i-1]*i)%MOD;
		inv[i]=(inv[i-1]*modpow(i, MOD-2))%MOD;
	}
	int k, n;
	string s;
	cin>>k>>s;
	n=s.size();
	long long ans=0;
	for(int i=n;i<=n+k;i++){
		long long add=(C(i-1, n-1)*modpow(25, i-n))%MOD;
		add=(add*modpow(26, n+k-i))%MOD;
		ans=(add+ans)%MOD;
	}
	cout<<ans;

}