#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 1, maxsq = 500;
const long long int Mod = 1000 * 1000 * 1000 + 7;
int sum[maxsq][maxn];
long long int makoos[maxn], P[maxn];
int n, num[maxn], ty[maxn];
vector<int> all;
long long int Pow(long long int x, long long int y) {
  long long int ret = 1, an = x;
  while (y) {
    if (y & 1) ret = (ret * an) % Mod;
    an = (an * an) % Mod;
    y >>= 1;
  }
  return ret;
}
long long int Div(long long int x, long long int y) {
  return (x * Pow(y, Mod - 2)) % Mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  P[0] = 1;
  for (int i = 1; i < maxn; i++) {
    makoos[i] = Div(1, i);
    P[i] = (P[i - 1] * 26) % Mod;
  }
  string str;
  cin >> n >> str;
  int lastnum = ((int)(str).size());
  all.push_back(lastnum);
  for (int i = 0; i < n; i++) {
    cin >> ty[i];
    if (ty[i] == 1) {
      cin >> str;
      num[i] = ((int)(str).size());
      all.push_back(num[i]);
    } else
      cin >> num[i];
  }
  sort(all.begin(), all.end());
  all.resize(unique(all.begin(), all.end()) - all.begin());
  for (int i = 0; i < ((int)(all).size()); i++) {
    long long int val = Div(1, P[all[i]]);
    for (int j = all[i]; j < maxn; j++) {
      sum[i][j] = (sum[i][j - 1] + val) % Mod;
      val = (val * 25 * j) % Mod;
      val = (val * makoos[26]) % Mod;
      val = (val * makoos[j - all[i] + 1]) % Mod;
    }
  }
  lastnum = lower_bound(all.begin(), all.end(), lastnum) - all.begin();
  for (int i = 0; i < n; i++) {
    if (ty[i] == 1)
      lastnum = lower_bound(all.begin(), all.end(), num[i]) - all.begin();
    else
      cout << (1LL * sum[lastnum][num[i]] * P[num[i]]) % Mod << '\n';
  }
  return 0;
}
