#include <bits/stdc++.h>
using namespace std;
void ga(int N, int *A) {
  for (int i(0); i < N; i++) scanf("%d", A + i);
}
long long pw(long long n, long long k) {
  long long r(1);
  while (k) {
    if (k & 1) r *= n, r %= (1000000007);
    n *= n, n %= (1000000007);
    k >>= 1;
  }
  return r;
}
long long inv(long long a) { return pw(a, (1000000007) - 2); }
long long f[(100001)] = {1, 1}, I[(100001)] = {1, 1}, J[(100001)] = {1, 1};
void pre() {
  for (int k(2); k < (100001); k++)
    f[k] = f[k - 1] * k % (1000000007),
    J[k] =
        -(1000000007) / k * J[(1000000007) % k] % (1000000007) + (1000000007),
    I[k] = I[k - 1] * J[k] % (1000000007);
  ;
}
long long C(int N, int K) {
  return N < K ? 0 : (f[N] * I[K] % (1000000007)) * I[N - K] % (1000000007);
}
char s[(100001)];
int P[(450)][(100001)];
map<int, int> T;
int c, N, L, Q, a;
long long Y[(100001)] = {1}, Z[(100001)] = {1}, X[(100001)] = {1};
void pc() {
  if (T.count(L)) return;
  a = T[L] = c++;
  for (int k(1); k < L; k++) P[a][k] = 0;
  for (int k(L); k < (100001); k++)
    P[a][k] = (P[a][k - 1] + C(k - 1, L - 1) * Y[k - L] % (1000000007) * X[k] %
                                 (1000000007)) %
              (1000000007);
}
int go() {
  a = T[L];
  return Z[N] * P[a][N] % (1000000007);
}
int main(void) {
  for (int k(1); k < (100001); k++)
    Y[k] = Y[k - 1] * 25 % (1000000007), Z[k] = Z[k - 1] * 26 % (1000000007),
    X[k] = inv(Z[k]);
  pre();
  scanf("%d%s", &Q, s), L = strlen(s), pc();
  for (int i(0); i < Q; i++) {
    scanf("%d", &a);
    if (a - 1)
      scanf("%d", &N), printf("%d\n", go());
    else
      scanf("%s", s), L = strlen(s), pc();
  }
  return 0;
}
