AtCoder Beginner Contest 171 - Strivore

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-----
5
oof

-----Sample Output-----
575111451

For example, we can obtain proofend, moonwolf, and onionpuf, while we cannot obtain oofsix, oofelevennn, voxafolt, or fooooooo.

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
from functools import reduce

def comb(n, max_k, mod):
	res = [1] * (max_k + 1)
	t = 1
	for i in range(max_k + 1):
		res[i] *= t
		t *= n - i
		t %= mod
	n = reduce(lambda x, y: x * y % mod, range(1, max_k + 1), 1)
	n = pow(n, -1, mod)
	for i in reversed(range(max_k + 1)):
		res[i] *= n
		res[i] %= mod
		n *= i
		n %= mod
	return res
MOD = 10 ** 9 + 7

def resolve():
	K = int(input())
	N = len(input())
	res = 0
	x = 1
	com = comb(N + K, K, MOD)
	for c in com:
		res += x * c
		res %= MOD
		x *= 25
		x %= MOD
	print(res)
resolve()


mod = 10 ** 9 + 7
k = int(input())
s = input()
l = len(s)
fact = [1]
for i in range(1, k + l + 1):
	fact.append(fact[-1] * i % mod)
revfact = []
for i in range(k + l + 1):
	revfact.append(pow(fact[i], mod - 2, mod))
pows = [1]
for i in range(1, k + l + 1):
	pows.append(pows[-1] * 25 % mod)
ans = 0
for i in range(l, l + k + 1):
	ans += fact[l + k] * revfact[i] * revfact[l + k - i] * pows[l + k - i]
	ans %= mod
print(ans)


k = int(input())
s = input()
n = len(s)
MOD = 10 ** 9 + 7
d = pow(26, -1, MOD)
ans = val = pow(26, k, MOD)
for i in range(1, k + 1):
	val *= (i + n - 1) * 25 * pow(i, -1, MOD) * d % MOD
	val %= MOD
	ans += val
	ans %= MOD
print(ans)


def nCr(n, r, fac, finv):
	mod = 10 ** 9 + 7
	ans = fac[n] * (finv[r] * finv[n - r] % mod) % mod
	return ans
k = int(input())
s = input()
l = len(s)
n = l + k + 1
ans = 0
mod = 10 ** 9 + 7
fac = [1, 1] + [0] * n
finv = [1, 1] + [0] * n
inv = [1, 1] + [0] * n
for i in range(2, n + 1):
	fac[i] = fac[i - 1] * i % mod
	inv[i] = mod - inv[mod % i] * (mod // i) % mod
	finv[i] = finv[i - 1] * inv[i] % mod
for i in range(k + 1):
	ans += nCr(l - i + k - 1, l - 1, fac, finv) * pow(26, i, mod) * pow(25, k - i, mod)
	ans %= mod
print(ans)


k = int(input())
s = list(input())
mod = 10 ** 9 + 7
fact = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, k + len(s) + 5):
	fact.append(fact[-1] * i % mod)
	inv.append(inv[mod % i] * (mod - mod // i) % mod)
	finv.append(finv[-1] * inv[-1] % mod)

def nCr(n, r, mod):
	if r > n:
		return 0
	else:
		return fact[n] * finv[r] * finv[n - r] % mod
t = len(s)
ans = 0
dp = [0] * (k + 1)
dp[0] = 1
ans += pow(26, k)
for i in range(1, k + 1):
	x = nCr(t + i - 1, t - 1, mod) * pow(25, i, mod) % mod * pow(26, k - i, mod) % mod
	ans += x
	ans %= mod
print(ans % mod)


MOD = 10 ** 9 + 7
K = int(input())
S = input()
l = len(S)
fac = [1] * (K + l + 1)
for i in range(1, K + l + 1):
	fac[i] = fac[i - 1] * i % MOD
p25 = [1] * (K + 1)
p26 = [1] * (K + 1)
for i in range(1, K + 1):
	p25[i] = p25[i - 1] * 25 % MOD
	p26[i] = p26[i - 1] * 26 % MOD
ans = 0
for en in range(l - 1, l + K):
	t = fac[en] * pow(fac[en - l + 1], MOD - 2, MOD) * pow(fac[l - 1], MOD - 2, MOD) % MOD
	t = t * p25[en - l + 1] % MOD
	t = t * p26[l + K - 1 - en] % MOD
	ans = (ans + t) % MOD
print(ans)


MOD = 10 ** 9 + 7
K = int(input())
S = list(input())
len_S = len(S)

def invmod(a):
	return pow(a, MOD - 2, MOD)
fact_dic = {0: 1}
fact_inv_dic = {0: 1}
fact_mod = 1
for i in range(1, K + len_S + 1):
	fact_mod = fact_mod * i % MOD
	fact_dic[i] = fact_mod
	fact_inv_dic[i] = invmod(fact_mod)

def comb_mod_table(n, r):
	if 0 <= r <= n:
		return fact_dic[n] * fact_inv_dic[r] * fact_inv_dic[n - r]
	else:
		return 0
answer = pow(26, K + len_S, MOD)
pow25 = pow(25, K + len_S, MOD)
inv25 = invmod(25)
for i in range(len_S):
	answer -= comb_mod_table(K + len_S, i) * pow25
	pow25 = pow25 * inv25 % MOD
	answer %= MOD
print(answer)


def comb_mod(n, r, mod):
	ans = 1
	lis = []
	for i in range(r):
		ans *= n + i
		ans *= pow(i + 1, mod - 2, mod)
		ans %= mod
		lis.append(ans)
	return lis

def solve():
	ans = 1
	mod = 10 ** 9 + 7
	K = int(input())
	S = input()
	s = len(S)
	lis = comb_mod(s, K, mod)
	for k in range(K):
		ans *= 26
		ans += lis[k] * pow(25, k + 1, mod)
		ans %= mod
	return ans
print(solve())


K = int(input())
N = len(input())
mod = 10 ** 9 + 7
div = pow(26, -1, mod)
comb_i = pow(26, K, mod)
ans = comb_i
for i in range(1, K + 1):
	comb_i = comb_i * (N - 1 + i) * pow(i, -1, mod) % mod
	comb_i = comb_i * 25 * div % mod
	ans = (ans + comb_i) % mod
print(ans)


class Cmb:
	g1 = [1, 1]
	g2 = [1, 1]
	inv = [0, 1]

	def __init__(self, mod, upper_limit):
		self.mod = mod
		for i in range(2, upper_limit + 1):
			Cmb.g1.append(Cmb.g1[-1] * i % mod)
			Cmb.inv.append(-Cmb.inv[mod % i] * (mod // i) % mod)
			Cmb.g2.append(Cmb.g2[-1] * Cmb.inv[-1] % mod)

	def cmb(self, n, r):
		if r < 0 or n < r:
			return 0
		r = min(r, n - r)
		return Cmb.g1[n] * Cmb.g2[r] * Cmb.g2[n - r] % self.mod
k = int(input())
s = len(input())
mod = 10 ** 9 + 7
Cmb = Cmb(mod, k + s)
ans = 1
for i in range(1, k + 1):
	ans = (ans * 26 + Cmb.cmb(i + s - 1, s - 1) * pow(25, i, mod)) % mod
print(ans)


K = int(input())
S = input()
M = 10 ** 9 + 7
f = 1
Fact = [f]
for i in range(1, len(S) + K + 1):
	f = f * i % M
	Fact.append(f)
Inv = [0] * (len(S) + K + 1)
g = pow(f, M - 2, M)
Inv = [0] * (len(S) + K + 1)
Inv[-1] = g
for j in range(len(S) + K - 1, -1, -1):
	Inv[j] = Inv[j + 1] * (j + 1) % M

def nCr(n, r):
	if 0 <= r <= n:
		return Fact[n] * Inv[r] * Inv[n - r] % M
	else:
		return 0
A = len(S)
T = 0
for i in range(K + 1):
	T = (T + nCr(A + K - 1 - i, K - i) * pow(25, K - i, M) * pow(26, i, M)) % M
print(T)


K = int(input())
S = input()
X = len(S)
mod = 10 ** 9 + 7
temp = pow(26, K, mod)
ans = pow(26, K, mod)
Y = 25 * pow(26, mod - 2, mod)
for i in range(X + 1, K + X + 1):
	temp *= Y
	temp %= mod
	temp *= i - 1
	temp %= mod
	temp *= pow(i - X, mod - 2, mod)
	temp %= mod
	ans += temp
	ans %= mod
print(ans)


k = int(input())
s = input()
n = len(s)
MOD = 10 ** 9 + 7
ans = 0
comb = 1
for i in range(k + 1):
	if i > 0:
		comb = comb * (n + i - 1) * pow(i, MOD - 2, MOD) % MOD
	ans = (ans + comb * pow(25, i, MOD) * pow(26, k - i, MOD)) % MOD
print(ans)


def main():
	mod = 10 ** 9 + 7
	K = int(input())
	S = input()
	Nk = len(S)
	ret = 0
	nCk = 1
	pw25 = 1
	pw26 = pow(26, K, mod)
	inv26 = pow(26, mod - 2, mod)
	for i in range(K + 1):
		ret += nCk * pw25 * pw26
		ret %= mod
		nCk *= (i + Nk) * pow(i + 1, mod - 2, mod)
		nCk %= mod
		pw25 = pw25 * 25 % mod
		pw26 = pw26 * inv26 % mod
	print(ret)
main()


k = int(input())
s = len(input())
c = 1
m = 10 ** 9 + 7
p = 0
a = [1]
b = [1]
for i in range(k):
	a.append(a[-1] * 25 % m)
	b.append(b[-1] * 26 % m)
for i in range(k + 1):
	p = (p + a[i] * b[k - i] * c) % m
	c = c * (s + i) * pow(i + 1, m - 2, m) % m
print(p)


mod = 10 ** 9 + 7
k = int(input())
s = input()
l = len(s)
fact = [1]
for i in range(1, k + l + 1):
	fact.append(fact[-1] * i % mod)
revfact = []
for i in range(k + l + 1):
	revfact.append(pow(fact[i], mod - 2, mod))
pow1 = [1]
pow2 = [1]
for i in range(1, k + l + 1):
	pow1.append(pow1[-1] * 25 % mod)
	pow2.append(pow2[-1] * 26 % mod)
ans = 0
for i in range(k + l):
	coef1 = pow1[k - i] * pow2[i] % mod
	if i <= k:
		coef2 = fact[k + l - 1 - i] * revfact[l - 1] * revfact[k - i] % mod
	else:
		coef2 = 0
	ans += coef1 * coef2
	ans %= mod
print(ans)


k = int(input())
s = input()
l = len(s)
mod = 10 ** 9 + 7
n = l + k
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)

def cmb(n, r):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
ans = 0
for i in range(l, l + k + 1):
	ans = (ans + cmb(i - 1, l - 1) * pow(25, k - (l + k - i), mod) * pow(26, l + k - i, mod)) % mod
print(ans)


n = int(input())
s = input()
S = len(s)
mod = 10 ** 9 + 7
tmp_ans = pow(26, n, mod)
div = pow(26, -1, mod)
ans = tmp_ans
for i in range(1, n + 1):
	tmp_ans = tmp_ans * 25 * div % mod
	tmp_ans = tmp_ans * (S - 1 + i) * pow(i, -1, mod) % mod
	ans = (ans + tmp_ans) % mod
ans %= mod
print(ans)


k = int(input())
s = input()
n = len(s)
mod = 10 ** 9 + 7
m = [1] * (k + 1)
M = [1] * (k + 1)
h = [1] * (k + 1)
for i in range(k):
	m[i + 1] = m[i] * 25 % mod
	M[i + 1] = M[i] * 26 % mod
	h[i + 1] = h[i] * (n + i) * pow(i + 1, mod - 2, mod) % mod
ans = 0
for i in range(k + 1):
	ans += m[i] * M[k - i] % mod * h[i] % mod
	ans %= mod
print(ans)


import sys
MOD = 10 ** 9 + 7
K = int(input())
S = input()
l = len(S)
ans = 0
tmp = pow(26, K, MOD)
ans = tmp
waru = pow(26, -1, MOD)
for i in range(1, K + 1):
	tmp = tmp * 25 * waru % MOD
	tmp = tmp * (l - 1 + i) * pow(i, -1, MOD) % MOD
	ans = (ans + tmp) % MOD
print(ans)


M = 10 ** 9 + 7
(k, n) = (int(input()), len(input()))
a = t = pow(26, k, M)
for i in range(k):
	t = t * 25 * (i + n) * pow(26 * (i + 1), -1, M) % M
	a += t
print(a % M)


def C(n, r):
	global MOD
	if r < 0 or n < r:
		return 0
	r = min(r, n - r)
	return fact[n] * factinv[r] * factinv[n - r] % MOD
K = int(input())
S = input()
N = len(S)
MOD = 10 ** 9 + 7
ans = 0
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, K + N + 1):
	fact.append(fact[-1] * i % MOD)
	inv.append(-inv[MOD % i] * (MOD // i) % MOD)
	factinv.append(factinv[-1] * inv[-1] % MOD)
for i in range(0, K + 1):
	ans += C(i + N - 1, N - 1) * pow(25, i, MOD) * pow(26, K - i, MOD)
	ans %= MOD
print(ans)


def main():
	from builtins import pow
	K = int(input())
	S = input()
	m = 1000000007
	result = 0
	t = pow(26, K, m)
	u = pow(26, -1, m) * 25 % m
	l = len(S)
	for i in range(K + 1):
		result = (result + t) % m
		t = t * u % m * (l + i) * pow(i + 1, -1, m) % m
	print(result)
main()


def nCr(n, r):
	return fact[n] * (inv[n - r] % M) * (inv[r] % M)
M = 1000000007
k = int(input())
s = len(input())
t = k + s
fact = [1]
p25 = [1]
for i in range(1, t + 1):
	fact += [fact[-1] * i % M]
	if i <= k:
		p25 += [p25[-1] * 25 % M]
inv = [1] * (t + 1)
inv[t] = pow(fact[t], M - 2, M)
for i in range(t - 1, -1, -1):
	inv[i] = inv[i + 1] * (i + 1) % M
res = 0
for i in range(k + 1):
	res += nCr(t, t - i) * p25[i]
	res %= M
print(res)


mod = 10 ** 9 + 7

def factrial(N):
	fc = [1, 1] + [None] * N
	inv = [0, 1] + [None] * N
	fcInv = [1, 1] + [None] * N
	for i in range(2, N + 1):
		fc[i] = i * fc[i - 1] % mod
		inv[i] = mod - inv[mod % i] * (mod // i) % mod
		fcInv[i] = fcInv[i - 1] * inv[i] % mod
	return (fc, fcInv)

def modCom(n, k):
	return 0 if n < k else fc[n] * fcInv[k] * fcInv[n - k] % mod
K = int(input())
S = input()
L = len(S)
(fc, fcInv) = factrial(L + K)
ans = 0
for i in range(K + 1):
	ans += modCom(K - i + L - 1, L - 1) * pow(25, K - i, mod) * pow(26, i, mod)
	ans %= mod
print(ans)


n = int(input())
s = input()
l = len(s)
mod = 10 ** 9 + 7
now = 1
for _ in range(n + l):
	now *= 25
	now %= mod

def inv(x):
	y = 1
	while x != 1:
		y *= mod // x + 1
		x -= mod % x
	return y
ans = 0
for i in range(n + l):
	now *= n + l - i
	now *= inv(i + 1)
	now *= inv(25)
	now %= mod
	if i + 1 >= l:
		ans += now
		ans %= mod
print(ans)


K = int(input())
S = input()
N = len(S)
mod = int(1000000000.0 + 7)
wk = pow(26, K, mod)
inv26 = pow(26, -1, mod)
ans = wk
for i in range(1, K + 1):
	wk = wk * 25 * inv26 % mod
	wk = wk * (N - 1 + i) * pow(i, -1, mod) % mod
	ans = (ans + wk) % mod
print(ans)


k = int(input())
n = len(input())
mod = pow(10, 9) + 7
c = 1
ans = pow(26, k, mod)
for i in range(1, k + 1):
	c *= (i + n - 1) * pow(i, mod - 2, mod)
	c %= mod
	ans += c * pow(25, i, mod) * pow(26, k - i, mod)
	ans %= mod
print(ans)


k = int(input())
s = input()
s = len(s)
mod = 10 ** 9 + 7
n = k + s

def _fac_inv(_n, _mod):
	_fac = [1] * (_n + 1)
	_inv = [1] * (_n + 1)
	for i in range(_n):
		_fac[i + 1] = _fac[i] * (i + 1) % _mod
	_inv[_n] = pow(_fac[_n], _mod - 2, _mod)
	for i in range(_n, 0, -1):
		_inv[i - 1] = _inv[i] * i % _mod
	return (_fac, _inv)
(fac, inv) = _fac_inv(n, mod)
n25 = [1]
n26 = [1]
for _ in range(n - s):
	n25.append(n25[-1] * 25 % mod)
	n26.append(n26[-1] * 26 % mod)
ans = 0
for i in range(s, n + 1):
	ans = (ans + fac[i - 1] * inv[s - 1] * inv[i - s] * n25[i - s] * n26[n - i]) % mod
print(ans)


def prepare(n):
	global MOD
	modFacts = [0] * (n + 1)
	modFacts[0] = 1
	for i in range(n):
		modFacts[i + 1] = modFacts[i] * (i + 1) % MOD
	invs = [1] * (n + 1)
	invs[n] = pow(modFacts[n], MOD - 2, MOD)
	for i in range(n, 1, -1):
		invs[i - 1] = invs[i] * i % MOD
	return (modFacts, invs)
MOD = 10 ** 9 + 7
K = int(input())
S = input()
L = len(S)
(modFacts, invs) = prepare(K + L)
ans = 0
for n in range(L, L + K + 1):
	nonSi = pow(25, n - L, MOD) * pow(26, L + K - n, MOD) % MOD
	Si = modFacts[n - 1] * invs[L - 1] * invs[n - 1 - (L - 1)] % MOD
	ans += nonSi * Si
	ans %= MOD
print(ans)


k = int(input())
s = input()
n = len(s)
MAX = 10 ** 6
MOD = 10 ** 9 + 7
inv = [0] * (MAX + 1)
inv[1] = 1
for i in range(2, MAX + 1):
	(q, r) = divmod(MOD, i)
	inv[i] = -inv[r] * q % MOD
ans = val = pow(26, k, MOD)
for i in range(1, k + 1):
	val *= (i + n - 1) * 25 * inv[i] * inv[26] % MOD
	val %= MOD
	ans += val
	ans %= MOD
print(ans)


k = int(input())
s = input()
mod = 10 ** 9 + 7
n = k + len(s)
fact = [1] * (n + 1)
revfact = [1] * (n + 1)
for i in range(n):
	fact[i + 1] = (i + 1) * fact[i] % mod
revfact[n] = pow(fact[n], mod - 2, mod)
for i in reversed(range(n)):
	revfact[i] = (i + 1) * revfact[i + 1] % mod

def combination(n, k, p):
	return fact[n] * revfact[k] * revfact[n - k] % p
ans = 0
comb = []
tf = [1]
for i in range(n + 1):
	comb.append(combination(n, i, mod))
	tf.append(tf[-1] * 25 % mod)
del tf[-1]
tf.reverse()
for i in range(len(s), n + 1):
	ans += comb[i] * tf[i]
	ans %= mod
print(ans)


K = int(input())
S = input()
L = len(S)
MOD = 10 ** 9 + 7
MAXN = K + L + 5
fac = [1, 1] + [0] * MAXN
finv = [1, 1] + [0] * MAXN
inv = [0, 1] + [0] * MAXN
for i in range(2, MAXN + 2):
	fac[i] = fac[i - 1] * i % MOD
	inv[i] = -inv[MOD % i] * (MOD // i) % MOD
	finv[i] = finv[i - 1] * inv[i] % MOD

def comb(n, r):
	if n < r:
		return 0
	if n < 0 or r < 0:
		return 0
	return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD
ans = 0
for i in range(K + 1):
	ans += comb(L - 1 + i, i) * pow(25, i, MOD) * pow(26, K - i, MOD)
	ans %= MOD
print(ans)


k = int(input())
s = input()
mod = 10 ** 9 + 7
n = len(s)
framod = [1]

def framod_calc(n, mod, a=1):
	for i in range(1, n + 1):
		a = a * i % mod
		framod.append(a)
framod_calc(n + k + 1, mod)

def combmod(n, k, mod):
	a = framod[n]
	b = framod[k]
	c = framod[n - k]
	return a * pow(b, mod - 2, mod) * pow(c, mod - 2, mod) % mod
ans = 0
for i in range(k + 1):
	ans += pow(26, i, mod) * pow(25, k - i, mod) * combmod(n + (k - i) - 1, n - 1, mod)
	ans %= mod
print(ans)


MOD = 10 ** 9 + 7
k = int(input())
s = input()
n = len(s)
U = n + k
fact = [0] * (U + 1)
fact[0] = 1
for i in range(1, U + 1):
	fact[i] = fact[i - 1] * i % MOD
invfact = [0] * (U + 1)
invfact[U] = pow(fact[U], MOD - 2, MOD)
for i in reversed(range(U)):
	invfact[i] = invfact[i + 1] * (i + 1) % MOD

def nCr(n, r):
	if r < 0 or n < r:
		return 0
	return fact[n] * invfact[r] * invfact[n - r]
ans = 0
for x in range(k + 1):
	ans += pow(26, x, MOD) * nCr(n + k - x - 1, n - 1) * pow(25, k - x, MOD)
	ans %= MOD
print(ans)


k = int(input())
S = input()
n = len(S)
mod = 10 ** 9 + 7
facs = [1] * (n + k)
nfac = 1
for i in range(1, n + k):
	nfac = nfac * i % mod
	facs[i] = nfac
invn1 = pow(facs[n - 1], mod - 2, mod)
ans = 0
for i in range(k + 1):
	left = facs[i + n - 1] * pow(facs[i], mod - 2, mod) * invn1 % mod
	left = left * pow(25, i, mod) % mod
	ans += left * pow(26, k - i, mod) % mod
	ans %= mod
print(ans)


import sys
input = sys.stdin.readline
k = int(input())
s = input().rstrip()
INF = 10 ** 9 + 7
ans = 0
n = len(s)

def modinv(a, m):
	b = m
	(x, lastx) = (0, 1)
	(y, lasty) = (1, 0)
	while not b == 0:
		q = a // b
		(a, b) = (b, a % b)
		(x, lastx) = (lastx - q * x, x)
		(y, lasty) = (lasty - q * y, y)
	return lastx % m
x = 26 ** k
y = modinv(26, INF)
c = 1
for i in range(k + 1):
	ans = (ans + c * x) % INF
	x = x * 25 * y % INF
	c = c * (n + i) * modinv(i + 1, INF) % INF
print(ans)


K = int(input())
S = input()
L = len(S)
MOD = 10 ** 9 + 7
modinv = lambda a, mod=MOD: pow(a, MOD - 2, mod)
x = pow(26, K, MOD)
comb = 1
ans = 0
for i in range(K, -1, -1):
	ans = (ans + comb * x) % MOD
	x = x * 25 * modinv(26) % MOD
	comb = comb * (L + K - i) * modinv(K - i + 1) % MOD
print(ans)


K = int(input())
S = input()
L = len(S)
MOD = 10 ** 9 + 7
factorials = [1]
fact_invs = [1]
for i in range(1, L + K + 1):
	factorials.append(factorials[-1] * i % MOD)
	fact_invs.append(pow(factorials[-1], MOD - 2, MOD))
ans = 1
for i in range(K):
	b = L + i
	a = L - 1
	nans = factorials[b]
	nans *= fact_invs[a]
	nans %= MOD
	nans *= fact_invs[b - a]
	nans %= MOD
	nans *= pow(25, b - a, MOD)
	nans %= MOD
	nans += ans * 26
	nans %= MOD
	ans = nans
print(ans)


mod = 10 ** 9 + 7
m = int(input())
n = len(input())
t = n + m
fac = [0] * (t + 1)
ifac = [0] * (t + 1)
pw = [0] * (t + 1)
fac[0] = 1
for i in range(1, t + 1):
	fac[i] = fac[i - 1] * i % mod
ifac[t] = pow(fac[t], mod - 2, mod)
for i in range(t - 1, -1, -1):
	ifac[i] = ifac[i + 1] * (i + 1) % mod
pw[0] = 1
for i in range(1, t + 1):
	pw[i] = pw[i - 1] * 25 % mod

def C(n, m):
	return fac[n] * ifac[m] * ifac[n - m] % mod
ans = 0
for i in range(n, t + 1):
	ans = (ans + pw[t - i] * C(t, i)) % mod
print(ans)


k = int(input())
s = list(input())
mod = 10 ** 9 + 7
nagasa = len(s)
ans = pow(26, k, mod)
bunbo = 1
bunshi = 1
for i in range(1, k + 1):
	bunbo *= nagasa - 1 + i
	bunshi *= pow(i, mod - 2, mod)
	bunbo %= mod
	bunshi %= mod
	temp = bunbo * bunshi
	temp %= mod
	temp *= pow(25, i, mod)
	temp %= mod
	temp *= pow(26, k - i, mod)
	temp %= mod
	ans += temp
	ans %= mod
print(ans)


P = 10 ** 9 + 7
K = int(input())
S = input()
L = len(S)
d = [0] * (L + K + 1)
d[0] = 1
for i in range(1, L + K + 1):
	d[i] = d[i - 1] * i % P
ans = 0
for i in range(K + 1):
	temp = pow(26, i, P) * pow(25, K - i, P)
	temp %= P
	temp *= d[L - 1 + K - i]
	temp %= P
	temp *= pow(d[L - 1], P - 2, P)
	temp %= P
	temp *= pow(d[K - i], P - 2, P)
	temp %= P
	ans += temp
	ans %= P
print(ans)


def comb(n, r, m):
	if r == 0:
		return 1
	return memf[n] * pow(memf[r], m - 2, m) * pow(memf[n - r], m - 2, m)

def memfact(a):
	temp = 1
	yield temp
	for i in range(1, a + 1):
		temp = temp * i % 1000000007
		yield temp
K = int(input())
S = input()
s = len(S)
ans = 0
m = 1000000007
memf = []
for x in memfact(s + K - 1):
	memf.append(x)
for i in range(K + 1):
	ans = (ans + comb(s + K - i - 1, K - i, m) * pow(25, K - i, m) * pow(26, i, m)) % m
print(ans)


MOD = 10 ** 9 + 7
K = int(input())
S = input()
N = len(S)
n = N + K
fac = [1] * (n + 1)
rev = [1] * (n + 1)
for i in range(1, n + 1):
	fac[i] = i * fac[i - 1] % MOD
	rev[i] = pow(fac[i], MOD - 2, MOD)
comb = lambda a, b: fac[a] * rev[a - b] * rev[b] % MOD
ans = 0
for i in range(K + 1):
	ans += pow(26, K - i, MOD) * pow(25, i, MOD) * comb(N + i - 1, i)
	ans %= MOD
print(ans)


k = int(input())
(s, m, c, a) = (input(), 10 ** 9 + 7, 1, 1)
for i in range(k):
	c *= 25 * (k + len(s) - i) * pow(i + 1, m - 2, m) % m
	c %= m
	a += c
print(a % m)


MOD = 10 ** 9 + 7

class Combination:

	def __init__(self, size):
		self.size = size + 2
		f = 1
		self.fact = fact = [f]
		for i in range(1, size + 1):
			f = f * i % MOD
			fact.append(f)
		f = pow(f, MOD - 2, MOD)
		self.factInv = factInv = [f]
		for i in range(size, 0, -1):
			f = f * i % MOD
			factInv.append(f)
		factInv.reverse()

	def npr(self, n, r):
		if n < r or n < 0 or r < 0:
			return 0
		return self.fact[n] * self.factInv[n - r] % MOD

	def ncr(self, n, r):
		if n < r or n < 0 or r < 0:
			return 0
		return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

	def nhr(self, n, r):
		return self.ncr(n + r - 1, n - 1)
K = int(input())
S = input()
N = len(S)
comb = Combination(N + K + 100)
ans = 0
L = 1
R = pow(26, K, MOD)
inv26 = pow(26, MOD - 2, MOD)
for l in range(K + 1):
	ans += L * comb.nhr(N, l) * R
	ans %= MOD
	L = L * 25 % MOD
	R = R * inv26 % MOD
print(ans)


Q = 10 ** 9 + 7

def getInv(N):
	inv = [0] * (N + 1)
	inv[0] = 1
	inv[1] = 1
	for i in range(2, N + 1):
		inv[i] = -(Q // i) * inv[Q % i] % Q
	return inv

def main():
	K = int(input())
	S = input()
	N = len(S)
	ans = 0
	cmb = 1
	Inv = getInv(K + 1)
	twenty_five = 1
	twenty_six = pow(26, K, Q)
	one_over_twenty_six = pow(26, Q - 2, Q)
	for i in range(K + 1):
		ans += cmb * twenty_five % Q * twenty_six % Q
		twenty_five *= 25
		twenty_five %= Q
		twenty_six *= one_over_twenty_six
		twenty_six %= Q
		ans %= Q
		cmb *= N + i
		cmb *= Inv[i + 1]
		cmb %= Q
	print(ans)

def __starting_point():
	main()
__starting_point()


mod = 10 ** 9 + 7
k = int(input())
s = len(input())
n = s + k
fac = [1] * (n + 1)
for i in range(1, n + 1):
	fac[i] = fac[i - 1] * i % mod
ans = 0
for i in range(s, n + 1):
	ncr = fac[i - 1] * pow(fac[i - s] * fac[s - 1] % mod, mod - 2, mod) % mod
	res = pow(26, n - i, mod) * pow(25, i - s, mod) % mod
	ans = (ans + res * ncr) % mod
print(ans)


k = int(input())
s = len(input())
mod = 10 ** 9 + 7
fact = [1] * (k + s + 1)
inv = [1] * (k + s + 1)
for i in range(2, k + s + 1):
	fact[i] = i * fact[i - 1] % mod
inv[-1] = pow(fact[-1], mod - 2, mod)
for i in range(k + s, 1, -1):
	inv[i - 1] = inv[i] * i % mod

def comb(x, y):
	return fact[x] * inv[y] % mod * inv[x - y] % mod if x >= y >= 0 else 0
ans = pow(26, k + s, mod)
for i in range(s):
	ans = (ans - pow(25, k + s - i, mod) * comb(k + s, i) % mod) % mod
print(ans)


k = int(input())
n = len(input())
p = 10 ** 9 + 7
a = 1
fct = [a]
for i in range(1, n + k + 1):
	a = a * i % p
	fct.append(a)
b = pow(fct[-1], p - 2, p)
inv = [b]
for i in range(1, n + k + 1)[::-1]:
	b = b * i % p
	inv.append(b)
inv.reverse()
ans = 0
(pow25, pow26) = ([1], [1])
for i in range(1, k + 1):
	pow25.append(pow25[-1] * 25 % p)
	pow26.append(pow26[-1] * 26 % p)
for i in range(k + 1):
	c = fct[i + n - 1] * inv[i] * inv[n - 1]
	ans += pow25[i] * pow26[k - i] * c
	ans %= p
print(ans)


k = int(input())
s = input()
mod = 10 ** 9 + 7
n = len(s) + k
frac = [1] * (n + 1)
finv = [1] * (n + 1)
for i in range(n):
	frac[i + 1] = (i + 1) * frac[i] % mod
finv[-1] = pow(frac[-1], mod - 2, mod)
for i in range(1, n + 1):
	finv[n - i] = finv[n - i + 1] * (n - i + 1) % mod

def nCr(n, r, m):
	if n < 0 or r < 0 or n < r:
		return 0
	r = min(r, n - r)
	return frac[n] * finv[n - r] * finv[r] % mod
(a, b) = ([1], [1])
for _ in range(k + 1):
	a.append(a[-1] * 25 % mod)
	b.append(b[-1] * 26 % mod)
n = len(s)
ans = 0
for i in range(k + 1):
	ans += a[i] * b[k - i] * nCr(i + n - 1, n - 1, mod)
	ans %= mod
print(ans)


k = int(input())
s = input()
mod = 10 ** 9 + 7
n = len(s)
fact = [1] * (k + n)
factinv = [1] * (k + n)
inv = [0, 1]
for i in range(2, k + n):
	fact[i] = fact[i - 1] * i % mod
	inv.append(-inv[mod % i] * (mod // i) % mod)
	factinv[i] = factinv[i - 1] * inv[i] % mod

def nCr(n, r):
	r = min(r, n - r)
	return fact[n] * factinv[r] * factinv[n - r] % mod
ans = 0
for i in range(k + 1):
	a = pow(25, i, mod)
	a *= nCr(i + n - 1, n - 1)
	a *= pow(26, k - i, mod)
	ans += a
	ans %= mod
print(ans)


k = int(input())
s = input()
n = len(s)
N = n + k - 1
mod = 1000000007
fact = [1] * (N + 1)
ifact = [1] * (N + 1)
for i in range(N):
	fact[i + 1] = fact[i] * (i + 1) % mod
	ifact[i + 1] = pow(fact[i + 1], mod - 2, mod)

def comb(x, y):
	if y < 0 or y > x:
		return 0
	return fact[x] * ifact[x - y] * ifact[y] % mod
m25 = [1]
for i in range(k):
	m25.append(m25[i] * 25 % mod)
m26 = [1]
for i in range(k):
	m26.append(m26[i] * 26 % mod)
ans = 0
for i in range(k + 1):
	p = m25[k - i] * m26[i] % mod
	p *= comb(n + k - i - 1, n - 1)
	p %= mod
	ans += p
	ans %= mod
print(ans)


k = int(input())
s = len(input())
MOD = 10 ** 9 + 7

def mod_inv(n):
	return pow(n, MOD - 2, MOD)
total = pow(26, k + s, MOD)
tmp = pow(25, k + s, MOD)
total = (total - tmp) % MOD
for i in range(0, s - 1):
	tmp = tmp * (k + s - i) % MOD * mod_inv((i + 1) * 25) % MOD
	total = (total - tmp) % MOD
print(total)


k = int(input())
s = input()
len_s = len(s)
p = 10 ** 9 + 7
pow26 = pow(26, k, p)
pow25 = pow(26, p - 1 - 1, p) * 25 % p
ans = 0
for i in range(k + 1):
	ans += pow26
	ans %= p
	pow26 = pow26 * pow25 % p * (len_s + i) % p * pow(i + 1, p - 2, p) % p
print(ans)


def main():
	mod = 10 ** 9 + 7
	k = int(input())
	s = input()
	n = len(s)
	fac = [1]
	for i in range(k + n + 1):
		fac.append(fac[-1] * (i + 1) % mod)

	def c(x, y):
		r = fac[y] * fac[x - y] % mod
		return fac[x] * pow(r, mod - 2, mod) % mod
	ans = 0
	for i in range(n, k + n + 1):
		r = c(i - 1, n - 1) * pow(25, i - n, mod) * pow(26, n + k - i, mod) % mod
		ans += r
		ans %= mod
	print(ans)
main()


K = int(input())
S = input()
m = 1000000007

def make_factorial_table(n):
	result = [0] * (n + 1)
	result[0] = 1
	for i in range(1, n + 1):
		result[i] = result[i - 1] * i % m
	return result

def mcomb(n, k):
	if n == 0 and k == 0:
		return 1
	if n < k or k < 0:
		return 0
	return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m
fac = make_factorial_table(len(S) - 1 + K)
result = 0
for i in range(K + 1):
	result += pow(26, i, m) * mcomb(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, m)
	result %= m
print(result)


def main():
	K = int(input())
	S = input()
	N = len(S)
	M = N + K
	p = 10 ** 9 + 7
	a = [None] * (M + 1)
	inva = [None] * (M + 1)
	a[0] = 1
	for i in range(1, M + 1):
		a[i] = i * a[i - 1] % p
	inva[M] = pow(a[M], p - 2, p)
	for i in range(M):
		inva[M - i - 1] = inva[M - i] * (M - i) % p
	ans = 0
	for i in range(K + 1):
		tmp = a[N + K - i - 1] * inva[N - 1] % p
		tmp = tmp * inva[K - i] % p
		tmp *= pow(25, K - i, p)
		tmp %= p
		tmp *= pow(26, i, p)
		tmp %= p
		ans = ans + tmp
		ans %= p
	print(ans)
main()


R = int(input())
s = input()
k = len(s)
n = R + k
MOD = 10 ** 9 + 7
factorials = [1]
current = 1
for i in range(1, n + 1):
	current = current * i % MOD
	factorials.append(current)
inverses = []
for i in range(n + 1):
	inverses.append(pow(factorials[i], MOD - 2, MOD))
ans = 0
for i in range(R + 1):
	ans = (ans + factorials[n] * inverses[i + k] * inverses[n - i - k] * pow(25, n - k - i, MOD)) % MOD
print(ans)


def solve(k, length, MOD, div, dp):
	for i in range(1, k + 1):
		dp[0] = dp[0] * 25 * div * (length + i - 1) * pow(i, -1, MOD) % MOD
		dp[1] = (dp[1] + dp[0]) % MOD
	return dp[1]
k = int(input())
s = input()
length = len(s)
MOD = 10 ** 9 + 7
div = pow(26, -1, MOD)
dp = [pow(26, k, MOD)] * 2
print(solve(k, length, MOD, div, dp))


k = int(input())
s = input()
MOD = 10 ** 9 + 7
FAC = [1]
INV = [1]
for i in range(1, len(s) + k + 1):
	FAC.append(FAC[i - 1] * i % MOD)
	INV.append(pow(FAC[-1], MOD - 2, MOD))

def nCr(n, r):
	return FAC[n] * INV[n - r] * INV[r]
p25 = [1]
for i in range(len(s) + k):
	p25.append(p25[-1] * 25 % MOD)
p26 = [1]
for i in range(len(s) + k):
	p26.append(p26[-1] * 26 % MOD)
ans = 0
for i in range(len(s), len(s) + k + 1):
	tmp = nCr(i - 1, len(s) - 1) * p25[i - len(s)]
	tmp %= MOD
	tmp *= p26[len(s) + k - i]
	tmp %= MOD
	ans += tmp
	ans %= MOD
print(ans)


import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
n_ = 2 * 10 ** 6 + 5
mod = 10 ** 9 + 7
fun = [1] * (n_ + 1)
for i in range(1, n_ + 1):
	fun[i] = fun[i - 1] * i % mod
rev = [1] * (n_ + 1)
rev[n_] = pow(fun[n_], mod - 2, mod)
for i in range(n_ - 1, 0, -1):
	rev[i] = rev[i + 1] * (i + 1) % mod

def nCr(n, r):
	if r > n:
		return 0
	return fun[n] * rev[r] % mod * rev[n - r] % mod

def modinv(x, mod):
	(a, b) = (x, mod)
	(u, v) = (1, 0)
	while b:
		t = a // b
		a -= t * b
		(a, b) = (b, a)
		u -= t * v
		(u, v) = (v, u)
	return u % mod
inv26 = modinv(26, mod)

def solve():
	k = ni()
	s = ns()
	n = len(s)
	ans = 0
	v = 1
	u = pow(26, k, mod)
	for i in range(n, n + k + 1):
		ans = (ans + nCr(i - 1, n - 1) * v * u) % mod
		u = u * inv26 % mod
		v = v * 25 % mod
	print(ans)
	return
solve()


mod = 10 ** 9 + 7

def inv(n):
	x = pow(n, mod - 2, mod)
	return x
k = int(input())
s = input()
l = len(s)
cmb = 1
ans = 1
for i in range(k):
	cmb = cmb * 25 * (k + l - i) * inv(i + 1)
	cmb %= mod
	ans += cmb
	ans %= mod
print(ans)


import sys
input = sys.stdin.readline
from collections import Counter
K = int(input())
S = input().rstrip('\n')
MOD = 10 ** 9 + 7
T = K + len(S)
fac = [1] * (T + 1)
for i in range(1, T + 1):
	fac[i] = fac[i - 1] * i % MOD
inv = [1] * (T + 1)
inv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(T - 1, -1, -1):
	inv[i] = inv[i + 1] * (i + 1) % MOD

def choose(n, k):
	return fac[n] * inv[n - k] % MOD * inv[k] % MOD
A = 1
l = len(S)
for i in range(K):
	A = A * 26 + pow(25, i + 1, MOD) * choose(len(S) + i, i + 1)
	A %= MOD
print(A % MOD)


def f_strivore(MOD=10 ** 9 + 7):
	K = int(input())
	S = input()
	length = len(S)

	class Combination(object):
		__slots__ = ['mod', 'fact', 'factinv']

		def __init__(self, max_val_arg: int=10 ** 6, mod: int=10 ** 9 + 7):
			(fac, inv) = ([1], [])
			(fac_append, inv_append) = (fac.append, inv.append)
			for i in range(1, max_val_arg + 1):
				fac_append(fac[-1] * i % mod)
			inv_append(pow(fac[-1], -1, mod))
			for i in range(max_val_arg, 0, -1):
				inv_append(inv[-1] * i % mod)
			(self.mod, self.fact, self.factinv) = (mod, fac, inv[::-1])

		def combination(self, n, r):
			return 0 if n < 0 or r < 0 or n < r else self.fact[n] * self.factinv[r] * self.factinv[n - r] % self.mod
	comb = Combination(length + K).combination
	f = [1] * (K + 1)
	tmp = 1
	for n in range(K + 1):
		f[n] = comb(length + n - 1, length - 1) * tmp % MOD
		tmp = tmp * 25 % MOD
	g = [1] * (K + 1)
	for n in range(1, K + 1):
		g[n] = (f[n] + 26 * g[n - 1]) % MOD
	return g[K]
print(f_strivore())


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MAX = 2 * 10 ** 6 + 10
MOD = 10 ** 9 + 7
fac = [1] * MAX
f_inv = [1] * MAX

def prepare(n, mod):
	for i in range(1, n + 1):
		fac[i] = fac[i - 1] * i % mod
	f_inv[n] = pow(fac[n], -1, MOD)
	for i in range(n - 1, 0, -1):
		f_inv[i] = f_inv[i + 1] * (i + 1) % MOD

def modcmb(n, r, mod):
	if n < 0 or r < 0:
		return 0
	if r > n:
		return 0
	return fac[n] * f_inv[r] * f_inv[n - r] % mod

def main():
	K = int(readline())
	S = readline().strip()
	N = len(S)
	prepare(N + K + 5, MOD)
	inv26 = pow(26, -1, MOD)
	pow26 = pow(26, K, MOD)
	pow25 = 1
	ans = 0
	for i in range(K + 1):
		ans += modcmb(N - 1 + i, i, MOD) * pow25 * pow26 % MOD
		ans %= MOD
		pow25 *= 25
		pow25 %= MOD
		pow26 *= inv26
		pow26 %= MOD
	print(ans)

def __starting_point():
	main()
__starting_point()


K = int(input())
S = input()
m = 1000000007
result = 0
t = pow(26, K, m)
u = pow(26, -1, m) * 25 % m
l = len(S)
for i in range(K + 1):
	result = (result + t) % m
	t = t * u % m * (l + i) % m * pow(i + 1, -1, m) % m
print(result)


k = int(input())
s = input()
p = 1000000007
x = 0
inv = [0, 1]
fact = [1, 1]
factinv = [1, 1]
for i in range(2, k + len(s) + 1):
	inv.append(-inv[p % i] * (p // i) % p)
	fact.append(fact[-1] * i % p)
	factinv.append(factinv[-1] * inv[-1] % p)

def cmb(n, r, p):
	return fact[n] * factinv[r] * factinv[n - r] % p
a = [1]
b = [1]
for _ in range(k):
	a.append(a[-1] * 25 % p)
	b.append(b[-1] * 26 % p)
for i in range(k + 1):
	x = (x + a[i] * b[k - i] * cmb(i + len(s) - 1, i, p)) % p
print(x)


k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007
x_i = pow(26, k, MOD)
r = 25 * pow(26, -1, MOD) % MOD
comb_i = 1
a = 0
for i in range(k + 1):
	a += comb_i * x_i % MOD
	a %= MOD
	x_i = x_i * r % MOD
	comb_i = comb_i * (len_s + i) * pow(i + 1, -1, MOD) % MOD
print(a)


K = int(input())
S = input()
m = 1000000007
result = 0
a = 1
b = 1
for i in range(K + 1):
	result += pow(26, K - i, m) * (a * pow(b, m - 2, m)) * pow(25, i, m)
	result %= m
	a *= len(S) - 1 + (i + 1)
	a %= m
	b *= i + 1
	b %= m
print(result)


K = int(input())
S = len(input())
mod = 10 ** 9 + 7
N = K + S
inverse = [0, 1]
for i in range(2, N + 1):
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
factorial = [1, 1]
factorial_inv = [1, 1]
for i in range(2, N + 1):
	factorial.append(factorial[-1] * i % mod)
	factorial_inv.append(factorial_inv[-1] * inverse[i] % mod)
answer = 0
pow = -1
for i in range(K + 1):
	if pow == -1:
		pow = 1
	else:
		pow = pow * 25 % mod
	answer = (answer + pow * factorial[N] * factorial_inv[i] * factorial_inv[N - i]) % mod
print(answer)


K = int(input())
S = input()
M = int(10 ** 9 + 7)
fact = [1]
for i in range(1, K + len(S) + 10):
	fact.append(fact[-1] * i % M)
finv = [pow(fact[-1], M - 2, M)]
for i in range(K + len(S) + 9, 0, -1):
	finv.append(finv[-1] * i % M)
finv.reverse()

def comb(a, b, m):
	return fact[a] * finv[b] % m * finv[a - b] % m

def hcomb(a, b, m):
	return comb(a + b - 1, a - 1, m)
ans = 0
for l in range(0, K + 1):
	ans += pow(26, l, M) * pow(25, K - l, M) % M * hcomb(len(S), K - l, M) % M
	ans %= M
print(ans)


import sys

def I():
	return int(sys.stdin.readline().rstrip())

def LS2():
	return list(sys.stdin.readline().rstrip())
K = I()
n = len(LS2())
mod = 10 ** 9 + 7
C = [1]
for i in range(1, K + 1):
	C.append(C[-1] * (i + n - 1) * pow(i, mod - 2, mod) % mod)
ans = 0
for i in range(K + 1):
	ans += C[i] * pow(25, i, mod) * pow(26, K - i, mod)
	ans %= mod
print(ans)


K = int(input())
S = input()
N = len(S)
MOD = 10 ** 9 + 7
fct = [1]
invfct = [1]
pow25 = [1]
pow26 = [1]
for i in range(1, K + N + 1):
	fct.append(fct[i - 1] * i % MOD)
	invfct.append(pow(fct[i], MOD - 2, MOD))
	pow25.append(pow25[i - 1] * 25 % MOD)
	pow26.append(pow26[i - 1] * 26 % MOD)

def cmb(n, k):
	return fct[n] * invfct[k] * invfct[n - k]
ans = 0
for i in range(K + 1):
	temp = pow25[i]
	temp *= cmb(i + N - 1, N - 1)
	temp *= pow26[K - i]
	ans += temp
	ans %= MOD
print(ans)


import math
k = int(input())
s = len(input())
mod = 10 ** 9 + 7
m25 = []
m26 = []
m_n = [1]
a = 1
b = 1
for i in range(k + 1):
	m25.append(a)
	a *= 25
	a %= mod
for i in range(k + 1):
	m26.append(b)
	b *= 26
	b %= mod
for i in range(2, k + s):
	x = mod % i
	y = mod // i
	c = -m_n[x - 1] * y
	c %= mod
	m_n.append(c)
samu = 0
fc = 1
for i in range(k):
	sm = fc
	sm *= m25[i]
	sm *= m26[k - i]
	sm %= mod
	samu += sm
	fc *= s + i
	fc %= mod
	fc *= m_n[i]
	fc %= mod
sm = fc
sm *= m25[k]
sm %= mod
samu += sm
samu %= mod
print(samu)


def COMinit():
	fac[0] = fac[1] = 1
	finv[0] = finv[1] = 1
	inv[1] = 1
	for i in range(2, max):
		fac[i] = fac[i - 1] * i % mod
		inv[i] = mod - inv[mod % i] * (mod // i) % mod
		finv[i] = finv[i - 1] * inv[i] % mod

def COM(n, k):
	if n < k:
		return 0
	if n < 0 or k < 0:
		return 0
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod
mod = 10 ** 9 + 7
K = int(input())
S = input()
N = len(S)
max = N + K
fac = [0] * max
finv = [0] * max
inv = [0] * max
COMinit()
ans = 0
for i in range(K + 1):
	x = COM(N + K - i - 1, N - 1)
	y = pow(26, i, mod)
	z = pow(25, K - i, mod)
	xyz = x * y % mod * z % mod
	ans = (ans + xyz) % mod
print(ans)


k = int(input())
n = len(input())
mod = 10 ** 9 + 7
f = [1] + [1]
for i in range(2, n + k + 1 + 26):
	f.append(f[-1] * i % mod)
inv = [0] + [1]
for i in range(2, n + k + 2 + 26):
	inv += [inv[mod % i] * (mod - int(mod / i)) % mod]
inv_f = [1, 1]
for i in range(2, n + k + 2 + 26):
	inv_f.append(inv_f[-1] * inv[i] % mod)

def c(x, y):
	return f[x] * inv_f[x - y] * inv_f[y]
ans = 0
for i in range(k + 1):
	ans += c(n + k - i - 1, n - 1) * pow(25, k - i, mod) * pow(26, i, mod)
print(ans % mod)


def main():
	K = int(input())
	S = input()
	N = len(S)
	mod = 10 ** 9 + 7
	r = 0
	t = pow(26, K, mod)
	s = 1
	inv26 = pow(26, mod - 2, mod)
	inv = [0] * (K + 2)
	inv[1] = 1
	for i in range(2, K + 2):
		inv[i] = -inv[mod % i] * (mod // i) % mod
	for i in range(K + 1):
		r = (r + t * s) % mod
		t = t * 25 * inv26 % mod
		s = s * (N + i) * inv[i + 1] % mod
	return r
print(main())


k = int(input())
n = len(input())
mod = 10 ** 9 + 7

def prepare(m, mod=10 ** 9 + 7):
	fac = [1] * (m + 1)
	inv = [1] * (m + 1)
	for i in range(1, m + 1):
		fac[i] = fac[i - 1] * i % mod
	inv[-1] = pow(fac[-1], mod - 2, mod)
	for i in range(m - 1, -1, -1):
		inv[i] = inv[i + 1] * (i + 1) % mod
	return (fac, inv)
(fac, inv) = prepare(n + k)

def cmb(n, r):
	assert n >= r >= 0
	return fac[n] * inv[n - r] * inv[r] % mod
ans = 0
for i in range(0, k + 1):
	ans += pow(25, k - i, mod) * pow(26, i, mod) % mod * cmb(n + k - i - 1, k - i) % mod
	ans %= mod
print(ans)


K = int(input())
S = input()
mod = 10 ** 9 + 7
N = len(S)

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
n = N + K
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
ans = cmb(N + K - 1, K, mod) * pow(25, K, mod) % mod
for i in range(1, K + 1):
	cnt = pow(26, i, mod)
	cnt *= cmb(N + K - i - 1, K - i, mod) * pow(25, K - i, mod)
	cnt %= mod
	ans += cnt
	ans %= mod
print(ans)


import sys
K = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip('\n')
N_MAX = 10 ** 6
MOD = 10 ** 9 + 7
inv = [0] * (N_MAX + 2)
inv[0] = 0
inv[1] = 1
for i in range(2, N_MAX + 2):
	(q, r) = divmod(MOD, i)
	inv[i] = -inv[r] * q % MOD
ans = 0
ln = len(S)
p = pow(26, K, MOD)
for i in range(1, K + 2):
	ans += p % MOD
	ans %= MOD
	p = p * (ln + i - 1) * inv[i] * 25 * inv[26] % MOD
print(ans)


K = int(input())
S = input()
s = len(S)
mod = int(1000000000.0 + 7)
n = pow(26, K, mod)
ans = n
for i in range(K):
	n = n * 25 * (s + i) * pow(26 * (i + 1), -1, mod) % mod
	ans = (ans + n) % mod
print(ans)


MOD = 10 ** 9 + 7
K = int(input())
S = input()
N = len(S)
M = K + N
s = [pow(26, K, MOD)]
r26 = pow(26, MOD - 2, MOD)
for i in range(1, K + 1):
	t = s[-1]
	t *= r26
	t *= 25
	t *= N + i - 1
	t *= pow(i, MOD - 2, MOD)
	t %= MOD
	s.append(t)
ans = sum(s) % MOD
print(ans)


import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
K = int(input())
S = input().rstrip()
N = K + len(S)
fact = [1] * (N + 1)
fact_inv = [1] * (N + 1)
for i in range(1, N + 1):
	fact[i] = i * fact[i - 1] % mod
fact_inv[N] = pow(fact[N], mod - 2, mod)
for i in range(1, N + 1)[::-1]:
	fact_inv[i - 1] = i * fact_inv[i] % mod
comb = lambda n, k: fact[n] * fact_inv[k] * fact_inv[n - k] % mod
ans = 0
for i in range(K + 1):
	ans = (ans + comb(K - i + len(S) - 1, len(S) - 1) * pow(25, K - i, mod) * pow(26, i, mod)) % mod
print(ans)


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10 ** 9 + 7
K = int(readline())
S = readline().decode().rstrip()
s = len(S) - 1
n = s + K
fact = [1] * (n + 1)
fact_inv = [1] * (n + 1)
for i in range(1, n + 1):
	fact[i] = fact[i - 1] * i % mod
fact_inv[n] = pow(fact[n], mod - 2, mod)
for i in range(n, 0, -1):
	fact_inv[i - 1] = i * fact_inv[i] % mod

def comb(n, r):
	return fact[n] * fact_inv[r] * fact_inv[n - r] % mod
ans = 0
for i in range(K + 1):
	ans += comb(i + s, s) * pow(25, i, mod) % mod * pow(26, K - i, mod) % mod
print(ans % mod)


from sys import stdin
input = stdin.readline

def nCr(n, r):
	return fact[n] * (inv[n - r] % M) * (inv[r] % M)
M = 1000000007
k = int(input())
s = len(input().strip())
t = k + s
fact = [1]
p25 = [1]
for i in range(1, t + 1):
	fact += [fact[-1] * i % M]
	if i <= k:
		p25 += [p25[-1] * 25 % M]
inv = [1] * (t + 1)
inv[t] = pow(fact[t], M - 2, M)
for i in range(t - 1, -1, -1):
	inv[i] = inv[i + 1] * (i + 1) % M
res = 0
for i in range(k + 1):
	res += nCr(t, t - i) * p25[i]
	res %= M
print(res)


MOD = 10 ** 9 + 7
K = int(input())
M = len(input())
N = M + K
pow25 = [1] * (N + 1)
fac = [1] * (N + 1)
inv = [1] * (N + 1)
for x in range(1, N + 1):
	fac[x] = fac[x - 1] * x % MOD
	pow25[x] = pow25[x - 1] * 25 % MOD
inv[N] = pow(fac[N], MOD - 2, MOD)
for x in range(N - 1, -1, -1):
	inv[x] = inv[x + 1] * (x + 1) % MOD

def binom(n, k):
	return fac[n] * inv[n - k] % MOD * inv[k] % MOD
ans = 0
for k in range(M, N + 1):
	ans += binom(N, k) * pow25[N - k] % MOD
	ans %= MOD
print(ans)


MOD = 10 ** 9 + 7
K = int(input())
S = len(input())
FCT = [1]
for i in range(1, K + S + 1):
	FCT.append(FCT[-1] * i % MOD)

def pmu(n, r, mod=MOD):
	return FCT[n] * pow(FCT[n - r], mod - 2, mod) % mod

def cmb(n, r, mod=MOD):
	return pmu(n, r) * pow(FCT[r], mod - 2, mod) % mod

def solve():
	ans = 1
	for i in range(S + 1, K + S + 1):
		ans = ans * 26 % MOD
		add = pow(25, i - S, MOD)
		add = add * cmb(i - 1, i - S) % MOD
		ans = (ans + add) % MOD
	return ans
print(solve())


import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
	k = ni()
	s = ns()
	n = len(s)
	mod = 1000000007
	ans = 0
	inv25 = pow(25, mod - 2, mod)
	tmp1 = 1
	tmp2 = pow(25, n + k, mod)
	for m in range(n):
		ans += tmp1 * tmp2 % mod
		ans %= mod
		tmp1 *= (n + k - m) * pow(m + 1, mod - 2, mod)
		tmp2 *= inv25
		tmp1 %= mod
		tmp2 %= mod
	ans = pow(26, n + k, mod) - ans
	ans %= mod
	print(ans)
	return
main()


def main():
	mod = pow(10, 9) + 7
	k = int(input())
	s = input()
	n = len(s)
	ans = 0
	key = pow(26, k, mod)
	sub = 1
	c = 1
	for i in range(k + 1):
		ans += key * sub * c
		ans %= mod
		sub *= 25
		sub %= mod
		key = key * pow(26, mod - 2, mod) % mod
		c *= n + i
		c *= pow(i + 1, mod - 2, mod)
		c %= mod
	print(ans)
main()


K = int(input())
S = input()
N = len(S)
MOD = 10 ** 9 + 7
factorial = [1, 1]
inverse = [1, 1]
invere_base = [0, 1]
for i in range(2, K + N + 1):
	factorial.append(factorial[-1] * i % MOD)
	invere_base.append(-invere_base[MOD % i] * (MOD // i) % MOD)
	inverse.append(inverse[-1] * invere_base[-1] % MOD)

def nCr(n, r):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return factorial[n] * inverse[r] * inverse[n - r] % MOD
ans = 0
for i in range(K + 1):
	ans += pow(25, i, MOD) * nCr(i + N - 1, N - 1) * pow(26, K - i, MOD) % MOD
	ans %= MOD
print(ans % MOD)


K = int(input())
S = input()
N = len(S)
MOD = 10 ** 9 + 7
n = N + K + 3
fac = [1] * (n + 1)
inv = [1] * (n + 1)
for j in range(1, n + 1):
	fac[j] = fac[j - 1] * j % MOD
inv[n] = pow(fac[n], MOD - 2, MOD)
for j in range(n - 1, -1, -1):
	inv[j] = inv[j + 1] * (j + 1) % MOD

def comb(n, r):
	if r > n or n < 0 or r < 0:
		return 0
	return fac[n] * inv[n - r] * inv[r] % MOD
ans = 0
for i in range(K + 1):
	p = comb(N + K - i - 1, N - 1) * pow(26, i, MOD) * pow(25, K - i, MOD) % MOD
	ans += p
	ans %= MOD
print(ans)


k = int(input())
s = input()
n = len(s)
mod = 10 ** 9 + 7
fac = [1] * (n + k + 2)
for i in range(1, n + k + 1):
	fac[i] = fac[i - 1] * i % mod

def c(n, k):
	return fac[n] * pow(fac[n - k] * fac[k] % mod, mod - 2, mod) % mod
ans = 0
for i in range(k + 1):
	ans += c(n - 1 + k - i, k - i) * pow(25, k - i, mod) * pow(26, i, mod) % mod
	ans %= mod
print(ans)


mod = 10 ** 9 + 7
k = int(input())
s = input()
n = len(s)
c = 1
t = 1
ans = 0
for i in range(k + 1):
	ans += c * t
	ans %= mod
	c *= (n + k - i) * pow(i + 1, mod - 2, mod)
	c %= mod
	t *= 25
	t %= mod
print(ans)


K = int(input())
S = input()
N = len(S)
mod = 10 ** 9 + 7
fact = [0] * (K + N)
fact[0] = fact[1] = 1
for i in range(2, K + N):
	fact[i] = fact[i - 1] * i % mod

def comb(n, r):
	ret = fact[n] * pow(fact[r], mod - 2, mod) * pow(fact[n - r], mod - 2, mod) % mod
	return ret
ans = 0
for i in range(K + 1):
	ans += pow(26, i, mod) * pow(25, K - i, mod) * comb(K + N - 1 - i, N - 1)
	ans %= mod
print(ans)


K = int(input())
S = list(str(input()))
N = len(S)
MOD = 10 ** 9 + 7
fac = [1, 1]
inv = [0, 1]
finv = [1, 1]
for i in range(2, N + K + 1):
	fac.append(fac[-1] * i % MOD)
	inv.append(MOD - inv[MOD % i] * (MOD // i) % MOD)
	finv.append(finv[-1] * inv[-1] % MOD)

def comb_mod(n, r, m):
	if n < 0 or r < 0 or n < r:
		return 0
	r = min(r, n - r)
	return fac[n] * finv[n - r] * finv[r] % m
ans = 0
for i in range(K + 1):
	tmp = pow(25, i, MOD)
	tmp *= comb_mod(i + N - 1, N - 1, MOD)
	tmp *= pow(26, K - i, MOD)
	ans += tmp
	ans %= MOD
print(ans)


K = int(input())
S = input()
s = len(S)
base = 10 ** 9 + 7
L26 = [1 for i in range(K + 1)]
for i in range(K):
	L26[i + 1] = L26[i] * 26 % base
T1 = 1
T2 = 1
ans = 0
for i in range(s, s + K + 1):
	T3 = L26[K + s - i]
	p = T1 * T2 % base
	p = p * T3 % base
	ans += p
	ans %= base
	T1 *= 25
	T1 %= base
	T2 *= i
	T2 %= base
	T2 *= pow(i + 1 - s, base - 2, base)
	T2 %= base
print(ans % base)


import sys
K = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip('\n')
N_MAX = 10 ** 6
MOD = 10 ** 9 + 7
inv = [0, 1]
for i in range(2, N_MAX + 2):
	inv.append(-inv[MOD % i] * (MOD // i) % MOD)
ans = 0
ln = len(S)
p1 = 1
p2 = 1
s2 = pow(26, K, MOD)
for i in range(1, K + 2):
	ans += p1 * p2 * s2 % MOD
	ans %= MOD
	p1 = p1 * (ln + i - 1) * inv[i] % MOD
	p2 = p2 * 25 % MOD
	s2 = s2 * inv[26] % MOD
print(ans)


k = int(input())
s = input()
l = len(s)
n = k + l
mod = 10 ** 9 + 7
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
	fac.append(fac[-1] * i % mod)
	inv.append(-inv[mod % i] * (mod // i) % mod)
	finv.append(finv[-1] * inv[-1] % mod)

def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif r == 0 or r == n:
		return 1
	else:
		return fac[n] * finv[r] * finv[n - r] % mod
print(sum((comb(k + l, m, mod) * pow(25, m, mod) % mod for m in range(k + 1))) % mod)


MOD = 10 ** 9 + 7
k = int(input())
n = len(input())
s = n + k
comb_s = [1]
rest = pow(25, s, MOD)
for i in range(1, n):
	comb_s.append(comb_s[-1] * (s + 1 - i) * pow(i, MOD - 2, MOD) % MOD)
	rest += pow(25, s - i, MOD) * comb_s[i]
print((pow(26, s, MOD) - rest) % MOD)


mod = 10 ** 9 + 7
K = int(input())
S = input()
n = len(S)
tmp = pow(26, K, mod)
waru = pow(26, -1, mod)
ans = tmp
for i in range(1, K + 1):
	tmp = tmp * 25 * waru % mod
	tmp = tmp * (i + n - 1) * pow(i, -1, mod) % mod
	ans = (ans + tmp) % mod
print(ans % mod)


def cmb(n, r, mod):
	if r < 0 or n < r:
		return 0
	r = min(r, n - r)
	return fact[n] * factinv[r] * factinv[n - r] % mod
mod = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
k = int(input())
s = input()
t = len(s)
n = k + t
for i in range(2, n + 1):
	fact.append(fact[-1] * i % mod)
	inv.append(inv[mod % i] * (mod - mod // i) % mod)
	factinv.append(factinv[-1] * inv[-1] % mod)
ans = 0
for i in range(k + 1):
	ans += cmb(k - i + t - 1, t - 1, mod) * pow(25, k - i, mod) * pow(26, i, mod) % mod
	ans %= mod
print(ans)


k = int(input())
s = input()

def pre(n, MOD):
	f = 1
	factor = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factor.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factor, invs)
MOD = 10 ** 9 + 7
n = len(s)
(factor, invs) = pre(n + k, MOD)
ans = 0
for i in range(k + 1):
	temp = 1
	temp = temp * factor[n - 1 + k - i] * invs[n - 1] * invs[k - i] % MOD
	temp = temp * pow(25, k - i, MOD) % MOD
	temp = temp * pow(26, i, MOD) % MOD
	ans = (ans + temp) % MOD
print(ans)


K = int(input())
N = len(input()) + K
P = 10 ** 9 + 7
nn = 2002002
fa = [1] * (nn + 1)
fainv = [1] * (nn + 1)
for i in range(nn):
	fa[i + 1] = fa[i] * (i + 1) % P
fainv[-1] = pow(fa[-1], P - 2, P)
for i in range(nn)[::-1]:
	fainv[i] = fainv[i + 1] * (i + 1) % P
C = lambda a, b: fa[a] * fainv[b] % P * fainv[a - b] % P if 0 <= b <= a else 0
s = 0
po = 1
for i in range(K + 1):
	s = (s + C(N, i) * po) % P
	po = po * 25 % P
print(s)


def comb(n, r, p):
	return fac[n] * facinv[r] * facinv[n - r] % p

def comb_pre(N_UNTIL, p):
	for i in range(2, N_UNTIL + 1):
		fac.append(fac[i - 1] * i % p)
		inv.append(-inv[p % i] * (p // i) % p)
		facinv.append(facinv[-1] * inv[-1] % p)
fac = [1, 1]
facinv = [1, 1]
inv = [0, 1]
K = int(input())
S = input()
N = len(S)
MOD = 1000000007
comb_pre(N + K - 1, MOD)
ans = 0
for i in range(K + 1):
	tmp = pow(25, K - i, MOD)
	tmp *= comb(N + K - i - 1, K - i, MOD)
	tmp %= MOD
	tmp *= pow(26, i, MOD)
	tmp %= MOD
	ans += tmp
	ans %= MOD
print(ans)


def calc_inv(n, mod_n):
	inv_li = [0] * (n + 2)
	inv_li[0] = 0
	inv_li[1] = 1
	for i in range(2, n + 2):
		(q, r) = divmod(mod_n, i)
		inv_li[i] = -inv_li[r] * q % mod_n
	return inv_li
K = int(input())
S = input()
s_len = len(S)
MOD = 10 ** 9 + 7
inv = calc_inv(max(K, 26) + 10, MOD)
ans = 0
p = pow(26, K, MOD)
for i in range(1, K + 2):
	ans = (ans + p % MOD) % MOD
	p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD
print(ans)


import sys, queue, math, copy, itertools, bisect, collections, heapq

def main():
	MOD = 10 ** 9 + 7
	NI = lambda : int(sys.stdin.readline())
	SI = lambda : sys.stdin.readline().rstrip()
	K = NI()
	S = SI()
	LS = len(S)
	f = [1] * (K + LS)
	r = [1] * (K + LS)
	c = 1
	for i in range(1, K + LS):
		c = c * i % MOD
		f[i] = c
		r[i] = pow(c, MOD - 2, MOD)

	def comb(n, k):
		return f[n] * r[k] * r[n - k] % MOD
	ans = 0
	for i in range(K + 1):
		ans = (ans + pow(25, i, MOD) * pow(26, K - i, MOD) * comb(i + LS - 1, LS - 1)) % MOD
	print(ans)
main()


k = int(input())
s = input()
n = len(s)
mod = 10 ** 9 + 7
f = [1, 1]
f_inv = [1, 1]
inv = [0, 1]
for i in range(2, n + k + 1):
	f.append(f[-1] * i % mod)
	inv.append(-inv[mod % i] * (mod // i) % mod)
	f_inv.append(f_inv[-1] * inv[-1] % mod)

def comb(n, k):
	return f[n] * f_inv[k] * f_inv[n - k] % mod
ans = 0
for i in range(k + 1):
	x = pow(25, i, mod) * pow(26, k - i, mod) * comb(n - 1 + i, n - 1)
	ans += x
	ans %= mod
print(ans)


def choose(n, a, mod):
	(x, y) = (1, 1)
	for i in range(a):
		x = x * (n - i) % mod
		y = y * (i + 1) % mod
	return x * pow(y, mod - 2, mod) % mod
k = int(input())
n = len(input())
mod = pow(10, 9) + 7
start = 1
ans = start * pow(26, k, mod)
for i in range(1, k + 1):
	start *= (i + n - 1) * pow(i, mod - 2, mod)
	start %= mod
	ans += start * pow(25, i, mod) * pow(26, k - i, mod)
	ans %= mod
print(ans)


def prepare(n, MOD):
	f = 1
	factorials = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factorials.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	invs[n] = inv
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factorials, invs)
k = int(input())
s = input()
l = len(s)
MOD = 10 ** 9 + 7
(facts, finvs) = prepare(k + l, MOD)
ans = 0
for i in range(k + 1):
	r = k - i
	pat = facts[l + r - 1] * finvs[l - 1] * finvs[r] % MOD
	ans = (ans + pat * pow(25, r, MOD) * pow(26, i, MOD)) % MOD
print(ans)


K = int(input())
S = input()
mod = 10 ** 9 + 7

def inv(x):
	return pow(x, mod - 2, mod)
N = len(S)
ans = 0
tmp1 = 1
tmp2 = 1
for i in range(0, K + 1):
	ans = ans + tmp1 * tmp2
	ans %= mod
	tmp1 = tmp1 * 25
	tmp1 %= mod
	tmp2 = tmp2 * (inv(i + 1) * (N + K - i))
	tmp2 %= mod
print(ans)


K = int(input())
S = input()
mod = 10 ** 9 + 7
N = len(S) + K
power = [1]
fac = [1]
inv = [1]
for i in range(1, N + 10):
	power.append(power[-1] * 25 % mod)
	fac.append(fac[-1] * i % mod)
inv = [pow(fac[-1], mod - 2, mod)]
for i in range(N + 10 - 1, 0, -1):
	inv.append(inv[-1] * i % mod)
inv = inv[::-1]

def comb(n, r):
	if r == 0:
		return 1
	return fac[n] * inv[n - r] * inv[r] % mod
ret = pow(26, N, mod)
for i in range(len(S)):
	ret -= power[N - i] * comb(N, i) % mod
	ret %= mod
print(ret)


def main():
	mod = 1000000007
	inv = lambda x: pow(x, mod - 2, mod)
	k = int(input())
	s = input().strip()
	l = len(s)
	n = k + l
	Fact = [1]
	for i in range(1, n + 1):
		Fact.append(Fact[i - 1] * i % mod)
	Finv = [0] * (n + 1)
	Finv[-1] = inv(Fact[-1])
	for i in range(n - 1, -1, -1):
		Finv[i] = Finv[i + 1] * (i + 1) % mod

	def comb(n, r):
		if n < r:
			return 0
		return Fact[n] * Finv[r] * Finv[n - r] % mod
	ans = 0
	p = 1
	for i in range(l, l + k + 1)[::-1]:
		ans += comb(l + k, i) * p
		ans %= mod
		p *= 25
		p %= mod
	print(ans)
main()