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;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

ll modPow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n-1, p)) % p;
  ll t = modPow(a, n/2, p);
  return (t * t) % p;
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15);
  
  ll n;
  cin >> n;
  ll k = n;
  string s;
  cin >> s;
  n += s.size();

  vector<ll> fact(n+1); //階乗
  vector<ll> fact_inv(n+1); //階乗の逆元
  fact[0] = 1;
  for (int i = 0; i < n; i++) fact[i+1] = (fact[i] * (i+1)) % MOD;
  fact_inv[n] = modPow(fact[n], MOD-2, MOD);
  for (int i = n-1; i >= 0; i--) fact_inv[i] = (fact_inv[i+1] * (i+1)) % MOD;

  auto comb = [&](ll n0, ll r) { //MODで
    return (((fact[n0] * fact_inv[n0-r]) % MOD) * fact_inv[r]) % MOD;
  };

  vector<ll> pows(n+1);
  pows[0] = 1;
  for (int i = 1; i <= n; i++) {
    pows[i] = (pows[i-1]*25) % MOD;
  }

  ll ans = modPow(26, n, MOD);
  for (int i = 0; i < n-k; i++) {
    //cout << ans << endl;
    ans -= comb(n, i) * pows[n-i];
    ans = (ans + MOD * MOD) % MOD;
  }
  cout << ans << endl;
}