Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

pow26_i = pow(26, k, MOD)
inv_26 = pow(26, -1, MOD)
pow25_i = 1
comb_i = 1

a = 0
for i in range(k + 1):  
  a += (comb_i  * pow26_i* pow25_i ) % MOD
  a %= MOD
  
  pow26_i = (pow26_i * inv_26) % MOD
  pow25_i = (pow25_i * 25) % MOD
  comb_i = (comb_i * (len_s + i) * pow(i + 1, -1, MOD)) % MOD


print(a)

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

pow26_i = pow(26, k, MOD)
inv_26 = pow(26, -1, MOD)
pow25_i = 1
comb_i = 1

a = 0
for i in range(k + 1):  
  a += (((comb_i  * pow26_i) % MOD) * pow25_i ) % MOD
  a %= MOD
  
  pow26_i = (pow26_i * inv_26) % MOD
  pow25_i = (pow25_i * 25) % MOD
  comb_i = ((((comb_i * (len_s + i)) % MOD)) * pow(i + 1, -1, MOD)) % MOD


print(a)

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

pow26 = [1] * (k + 1)
pow25_i = 1
comb_i = 1

for i in range(k):
  pow26[i+1] = (pow26[i] * 26) % MOD

a = 0
for i in range(k + 1):  
  a += (((comb_i  * pow26[k-i]) % MOD) * pow25_i ) % MOD
  a %= MOD

  pow25_i = (pow25_i * 25) % MOD
  comb_i = ((((comb_i * (len_s + i)) % MOD)) * pow(i + 1, -1, MOD)) % MOD


print(a)

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

pow26 = [1] * (k + 1)
pow25 = [1] * (k + 1)
comb = [1] * (k + 1)

for i in range(k):
  pow26[i+1] = (pow26[i] * 26) % MOD
  pow25[i+1] = (pow25[i] * 25) % MOD
  comb[i+1] =((((comb[i] * (len_s + i)) % MOD)) * pow(i + 1, -1, MOD)) % MOD

a = 0
for i in range(k + 1):
  a += (((comb[k-i] * pow26[i]) % MOD) * pow25[k-i]) % MOD
  a %= MOD

print(a)

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()
len_s = len(s)
MOD = 1000000007

pow26 = [1] * (k + 1)
pow25 = [1] * (k + 1)
comb = [1] * (k + 1)

for i in range(k):
  pow26[i+1] = (pow26[i] * 26) % MOD
  pow25[i+1] = (pow25[i] * 25) % MOD
  comb[i+1] = (comb[i] * (len_s + i) * pow(i + 1, -1, MOD)) % MOD

a = 0
for i in range(k + 1):
  a += (comb[k-i] * pow26[i] * pow25[k-i]) % MOD
  a %= MOD

print(a)

Fixed submission:
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)