#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
const int MAXN = 100005;
int jc[MAXN], rjc[MAXN], Q, l, n, a25[MAXN];
int ans[450][MAXN], cnt, ma[MAXN];
char s[MAXN];
void make() {
  jc[0] = jc[1] = rjc[1] = rjc[0] = a25[0] = 1;
  for (int i = 2; i < MAXN; ++i) {
    jc[i] = 1ll * jc[i - 1] * i % mo;
    rjc[i] = 1ll * (mo - mo / i) * rjc[mo % i] % mo;
  }
  for (int i = 1; i < MAXN; ++i) {
    a25[i] = a25[i - 1] * 25ll % mo;
    rjc[i] = 1ll * rjc[i] * rjc[i - 1] % mo;
  }
}
void calc(int x) {
  int y = ma[x];
  ans[y][x] = 1;
  for (int i = x + 1; i <= 100000; ++i)
    ans[y][i] = (ans[y][i - 1] * 26ll + 1ll * a25[i - x] * jc[i - 1] % mo *
                                            rjc[x - 1] % mo * rjc[i - x]) %
                mo;
}
int main() {
  make();
  scanf("%d%s", &Q, s);
  int op;
  l = strlen(s);
  ma[l] = ++cnt;
  calc(l);
  while (Q--) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%s", s);
      l = strlen(s);
      if (!ma[l]) ma[l] = ++cnt, calc(l);
    } else {
      scanf("%d", &n);
      if (n < 1) {
        puts("0");
        continue;
      } else
        printf("%d\n", ans[ma[l]][n]);
    }
  }
  return 0;
}
