#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 450;
const int mod = 1e9 + 7;
int done[maxn], f[maxm][maxn];
long long inv[maxn];
long long qpow(long long x, int n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * x % mod;
    x = x * x % mod;
    n /= 2;
  }
  return ans;
}
int now, cnt;
void calc(int x) {
  if (done[x]) {
    now = done[x];
    return;
  }
  now = done[x] = ++cnt;
  long long c = 1, p = 1;
  f[now][x] = 1;
  for (int i = x + 1; i < maxn; i++) {
    c = c * (i - 1) % mod * inv[i - x] % mod, p = p * 25 % mod;
    f[now][i] = (26ll * f[now][i - 1] % mod + c * p % mod) % mod;
  }
}
char s[maxn];
int main() {
  for (int i = 1; i < maxn; i++) inv[i] = qpow(i, mod - 2);
  int m;
  scanf("%d%s", &m, s);
  calc(strlen(s));
  while (m--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%s", s);
      calc(strlen(s));
    } else {
      int n;
      scanf("%d", &n);
      printf("%d\n", f[now][n]);
    }
  }
  return 0;
}
