#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 1e9 + 7;
const int MAXN = 100005;
const int INF = 0x3f3f3f3f;
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
char st[MAXN];
int id[MAXN], f[355][MAXN], fac[MAXN], inv[MAXN], len = 0, num = 0;
int C(int x, int y) { return 1ll * fac[x] * inv[y] % mods * inv[x - y] % mods; }
int quick_pow(int x, int y) {
  int ret = 1;
  for (; y; y >>= 1) {
    if (y & 1) ret = 1ll * ret * x % mods;
    x = 1ll * x * x % mods;
  }
  return ret;
}
void Init(int n) {
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mods;
  inv[n] = quick_pow(fac[n], mods - 2);
  for (int i = n - 1; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mods;
}
void update(char *st) {
  len = strlen(st);
  if (id[len]) return;
  if (num == 350) num = rand() % 350 + 1;
  id[len] = ++num, f[num][len] = 1;
  for (int i = len + 1, pw = 25; i <= 1e5; i++, pw = 25ll * pw % mods)
    f[num][i] =
        (26ll * f[num][i - 1] % mods + 1ll * C(i - 1, len - 1) * pw % mods) %
        mods;
}
signed main() {
  srand(time(0));
  int Case = read();
  scanf("%s", st);
  Init(1e5);
  update(st);
  while (Case--) {
    int opt = read();
    if (opt == 1) {
      scanf("%s", st);
      update(st);
    } else {
      int x = read();
      printf("%d\n", f[id[len]][x]);
    }
  }
  return 0;
}
