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: Wrong Answer)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const ll MOD=1e9+7;
const long double Pi=acos(-1);
using  P=pair<ll,ll>;
ll gcd(ll a,ll b){//aとbの最大公約数を返す
  if(a%b==0){return b;}
  else{return gcd(b,a%b);}
}
ll lcm(ll a,ll b){//aとbの最小公倍数を返す
  return a*b/gcd(a,b);
}
ll mod_pow(ll a,ll b) {
    if(b==0){return 1;}
    ll res=mod_pow(a*a%MOD,b/2);
    if(b&1)res=res*a%MOD;
    return res;
}
ll nature(ll a){//絶対値を返す
  if(a>=0){return(a);}
  else{return(-1*a);}
}
ll prime(ll a){//素数なら1を返す
  if(a==2){return 1;}
  else if(a%2==0 || a==1){return 0;}
  for(ll i=3;i*i<=a;i+=2){if(a%i==0){return 0;}}
  return 1;
}
vector<ll> fact_inv, inv;
void init_nCk(int k){
  fact_inv.resize(k+5);
  inv.resize(k+5);
  fact_inv[0]=fact_inv[1]=1;
  inv[1]=1;
  for(int i=2;i<k+5;i++){
    inv[i]=MOD-inv[MOD % i]*(MOD/i)%MOD;
    fact_inv[i]=fact_inv[i-1]*inv[i]%MOD;
  }
}
int nCk(int n,int k){
  assert(!(n<k));
  assert(!(n<0||k<0));
  int ans=1;
  for(int i=n;i>=n-k+1;i--){
    ans*=i;
    ans%=MOD;
  }
  return ans*fact_inv[k]%MOD;
}
int main(){
  ll K;
  cin>>K;
  string S;
  cin>>S;
  ll a=S.size(),dp[K+10],ans[K+10];
  for(ll i=0;i<=K;i++){
    dp[i]=mod_pow(26,i);
    ans[i]=0;
  }
  ll rock[K+10];
  init_nCk(a-1);
  for(ll i=0;i<=K;i++){
    rock[i]=nCk(i+a-1,a-1)*mod_pow(25,i);
    rock[i]%=MOD;
  }
  for(ll i=0;i<=K;i++){
    for(ll j=0;j<=i;j++){
      ans[i]+=dp[i-j]*rock[j];
      ans[i]%=MOD;
    }
  }
  cout<<ans[K]<<endl;
}