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>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
ll n,m;
char str[1000010];
ll md=1e9+7;
ll inv[2000010];
ll ksm[2000010];
ll ksmi(ll x,ll y)
{
	ksm[0]=x;
	for (int i=1;i<=60;i++) ksm[i]=(ksm[i-1]*ksm[i-1])%md;
	ll res=1;
	for (int i=0;i<=60;i++) if (y & (1ll<<i)) res=(res*ksm[i])%md;
	return res; 
}
int main()
{
	scanf("%lld%s",&n,&str);
	string s=str;
	m=s.size(),n+=m;
	for (int i=1;i<=n;i++) inv[i]=ksmi(i,md-2);
	vector<ll> com;
	ll t=1;
	for (ll i=m-1;i<n;i++)
	{
		//cout <<t<<" ##\n";
		if (!(m-1)) com.push_back(1);
		else
		{
			com.push_back(t);
			t=(t*inv[i-(m-1)+1])%md;
			t=(t*(i+1))%md;
		}
	}
	//for (int i=0;i<com.size();i++) cout <<com[i]<<" ";
	//cout <<"\n";
	t=1;
	for (int i=0;i<com.size();i++) com[i]=(com[i]*t)%md,t=(t*25)%md;
	ll res=0;
	for (int i=0;i<com.size();i++) res=(((res*26)%md)+com[i])%md; 
	printf("%lld",res);
	return 0;
}