#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
long long p26[MAX], p25[MAX], inv[MAX];
long long f[MAX], mod = 1e9 + 7;
int ans[500][MAX];
map<int, int> mp;
long long ny(long long x) {
  int m = mod - 2;
  long long rt = 1, now = x;
  while (m) {
    if (m & 1) rt = (rt * now) % mod;
    now = (now * now) % mod;
    m /= 2;
  }
  return rt;
}
void init() {
  p26[0] = p25[0] = f[0] = inv[0] = 1;
  for (int i = 1; i <= 100002; i++) {
    p26[i] = (p26[i - 1] * 26) % mod;
    p25[i] = (p25[i - 1] * 25) % mod;
    f[i] = (f[i - 1] * i) % mod;
    inv[i] = ny(f[i]);
  }
}
void get_ans(int l) {
  int t = mp[l];
  memset(ans[t], 0, sizeof(ans[t]));
  ans[t][l] = 1;
  for (int i = l + 1; i <= 100002; i++) {
    long long temp = (inv[l - 1] * inv[i - l]) % mod;
    temp = (f[i - 1] * temp) % mod;
    temp = (temp * p25[i - l]) % mod;
    ans[t][i] = (1ll * ans[t][i - 1] * 26 + temp) % mod;
  }
}
char s[MAX];
int main() {
  init();
  int l, n, m;
  scanf("%d %s", &m, s);
  l = strlen(s);
  int count = 0;
  while (m--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%s", s);
      l = strlen(s);
    } else {
      if (!mp.count(l)) {
        mp[l] = ++count;
        get_ans(l);
      }
      scanf("%d", &n);
      printf("%d\n", ans[mp[l]][n]);
    }
  }
  return 0;
}
