D. 子序列
链接
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;
inline int read() {
int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}
const int N = 200005;
char s[N];
int fac[N], ifac[N];
const int mod = 1e9 + 7;
int ksm(int a,int b) {
int res = 1;
while (b) {
if (b & 1) res = 1ll * res * a % mod;
a = 1ll * a * a % mod;
b >>= 1;
}
return res;
}
int C(int n,int m) {
return 1ll * fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}
int main() {
fac[0] = 1;
for (int i = 1; i <= 100000; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
for (int i = 0; i <= 100000; ++i) ifac[i] = ksm(fac[i], mod - 2);
scanf("%s", s + 1);
int m = read(), n = strlen(s + 1);
LL Ans = 0;
for (int i = n; i <= m; ++i) {
Ans += 1ll * C(i - 1, n - 1) * ksm(25, i - n) % mod * ksm(26, m - i) % mod;
Ans %= mod;
}
cout << (Ans + mod) % mod;
return 0;
}