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<iostream>
#include<string>
using namespace std;

long long pow(long long a,long long b) {
  if(b == 0)return 1;
  else return (pow((a*a)%1000000007,b/2)*(b%2>0?a:1))%1000000007;
}

int main() {
  int K,S;
  string s;
  cin >> K >> s;
  S = s.length();
  long long F[2000010],iF[2000010];
  F[0] = 1;
  int i;
  for(i=0;i<2000000;i++)F[i+1] = F[i]*(i+1)%1000000007;
  for(i=0;i<=2000000;i++)iF[i] = pow(F[i],1000000005);
  long long ans = 0;
  for(i=0;i<=K;i++) {
    ans += (F[i+S-1]*iF[S-1]%1000000007)*(iF[i]*(pow(25,i)*pow(26,K-i)%1000000007)%1000000007)%1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}