#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, m;
long long fact[1000060];
long long l25[100050];
char X[100050];
long long inv[100050];
int ans[450][100001];
long long calc(long long x, long long k) {
  if (k == 0) return 1;
  long long ans = 1;
  while (k > 0) {
    if (k & 1) {
      ans *= x;
      ans %= mod;
    }
    x *= x;
    x %= mod;
    k >>= 1;
  }
  return ans;
}
int op;
int cnt = 0;
bool calcd[100050];
int pointx[100050];
void calcx(int x) {
  pointx[x] = ++cnt;
  for (int i = 1; i <= 100000; ++i) {
    if (i < x)
      ans[cnt][i] = 0;
    else {
      ans[cnt][i] = ((long long)ans[cnt][i - 1] * 26 +
                     l25[i - x] % mod * fact[i - 1] % mod * inv[x - 1] % mod *
                         inv[(i - 1) - (x - 1)] % mod) %
                    mod;
    }
  }
}
int main() {
  memset(ans, 0, sizeof(ans));
  scanf("%d", &m);
  fact[0] = 1;
  inv[0] = 1;
  l25[0] = 1;
  scanf("%s", X + 1);
  for (int i = 1; i <= 100005; ++i) {
    l25[i] = l25[i - 1] * 25 % mod;
    fact[i] = fact[i - 1] * i % mod;
    inv[i] = calc(fact[i], mod - 2);
  }
  int len = strlen(X + 1);
  calcx(len);
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &op);
    if (op == 1) {
      scanf(" %s", X + 1);
      len = strlen(X + 1);
      if (!calcd[len]) {
        calcx(len);
        calcd[len] = 1;
      }
    } else {
      scanf("%d", &op);
      if (op < len)
        printf("%d\n", 0);
      else
        printf("%d\n", ans[pointx[len]][op]);
    }
  }
}
