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;

const int mod = 1000000007;

long long power(long long a, int b) {
	if (!b) return 1;
	long long tmp = power(a, b >> 1);
	return b & 1 ? tmp * tmp % mod * a % mod : tmp * tmp % mod;
}

long long pw25[2000010], pw26[2000010], inv[2000010];

int main () {
	pw25[0] = pw26[0] = 1, inv[1] = 1;
	for (int i = 1; i <= 2000000; i++) {
		pw25[i] = pw25[i - 1] * 25 % mod;
		pw26[i] = pw26[i - 1] * 26 % mod;
		if (i > 1) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
	int k; cin >> k;
	string s; cin >> s;
	int n = s.size();
	long long ans = 0, C = 1;
	for (int lst = n; lst <= n + k; lst++) {
		ans = (ans + C * pw25[lst - n] % mod * pw26[n + k - lst]) % mod;
		C = C * lst % mod * inv[lst - n + 1] % mod;
	}
	cout << ans << endl;
	return 0;
}