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)

// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

const int Mod = 1e9 + 7;
const int N = 2e6 + 5;

int n, k;
string s;
ll fact[N], inv[N], invFact[N];

ll mpow(ll a, ll b) {
  ll r = 1;
  while(b > 0) {
    if(b & 1) r = (r * a) % Mod;
    a = (a * a) % Mod;
    b >>= 1;
  }
  return r;
}

ll C(int n, int k) {
  return fact[n] * invFact[k] % Mod * invFact[n - k] % Mod;
}

int main()
{
  ios::sync_with_stdio(false);

  fact[0] = fact[1] = 1;
  inv[0] = inv[1] = 1;
  invFact[0] = invFact[1] = 1;
  for(int i = 2; i < N; i++) {
    fact[i] = (fact[i - 1] * i) % Mod;
    inv[i] = Mod - Mod / i * inv[Mod % i] % Mod;
    invFact[i] = (invFact[i - 1] * inv[i]) % Mod;
  }

  cin >> k >> s;
  n = sz(s);
  ll ans = 0;
  for(int i = n; i <= n + k; i++) {
    ans += C(i - 1, n - 1) * mpow(25, i - n) % Mod * mpow(26, n + k - i) % Mod;
    ans %= Mod;
  }

  cout << ans << endl;

  return 0;
}