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 vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

namespace
{
	struct modint
	{
		static constexpr ll MOD = 1000000007;
		ll x_;
		modint() : x_(0) {}
		modint(ll x) : x_(x% MOD) {}
		modint& operator+=(const modint& src)
		{
			if ((x_ += src.x_) >= MOD)
				x_ -= MOD;
			return *this;
		}
		modint& operator-=(const modint& src)
		{
			if ((x_ += MOD - src.x_) >= MOD)
				x_ -= MOD;
			return *this;
		}
		modint& operator*=(const modint& src)
		{
			(x_ *= src.x_) %= MOD;
			return *this;
		}

		modint& operator/=(const modint& src)
		{
			return (*this) *= src.inv();
		}
		modint inv() const
		{
			return pow(MOD - 2);
		}
		modint pow(ll t) const
		{
			if (t == 0)
				return 1;
			modint a = pow(t >> 1);
			a *= a;
			if (t & 1)
				a *= *this;
			return a;
		}
	};


	ll ModPow(ll a, ll p, ll mod)
	{
		if (p == 0)
			return 1;
		if (p % 2 == 0)
		{
			ll halfp = p / 2;
			ll half = ModPow(a, halfp, mod);
			return (half * half) % mod;
		}
		else
		{
			return (a * ModPow(a, p - 1, mod)) % mod;
		}
	}
	ll Combination(int n, int r, ll mod)
	{
		r = min(r, n - r);
		ll num = 1;
		ll den = 1;
		for (int i = 0; i < r; ++i)
		{
			num *= (n - i);
			num %= mod;
			den *= (i + 1);
			den %= mod;
		}
		ll ret = (num * ModPow(den, mod - 2, mod)) % mod;
		return ret;
	}
}

void ABC171F()
{
	const ll MOD = 1000000007;
	int K;
	cin >> K;
	string S;
	cin >> S;
	int N = S.size();
	modint last = 1;
	modint first = 1;
	for (int i = 0; i < K; ++i)
	{
		first *= 25;
	}

	modint sum = 0;
	modint comb = Combination(K + N - 1, N - 1, MOD);
	for (int i = 0; i <= K; ++i)
	{
		int m = K - i + N - 1;
		modint tmp = last;
		tmp *= first;
		tmp *= comb;
		comb *= m - (N - 1);
		comb /= m;

		sum += tmp;
		first /= 25;
		last *= 26;
	}
	cout << sum.x_ << endl;
}

int main()
{
	ABC171F();
	return 0;
}