#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, LEN = 100100;
int m, t, n, len;
string st;
vector<pair<int, int> > q[LEN];
long long res[LEN], power[LEN];
long long getpow(long long a, long long n) {
  if (n == 0) return 1;
  long long res = getpow(a, n / 2);
  res = (res) * (res) % MOD;
  if (n % 2) res = (res * a) % MOD;
  return res;
}
void getans(vector<pair<int, int> > &q, long long len) {
  if (q.size() == 0) return;
  sort(q.begin(), q.end());
  long long cnt = 1, step = 1, cnk = 1;
  for (int i = 0; i < q.size(); i++) res[q[i].second] = 0;
  int j = 0;
  for (long long i = len; i <= q[q.size() - 1].first; i++) {
    while (j + 1 < q.size() && q[j].first < i) j++;
    while (q[j].first == i) {
      res[q[j].second] = cnt;
      if (j + 1 < q.size())
        j++;
      else
        break;
    }
    cnk = (cnk * i) % MOD;
    cnk = (cnk * power[i + 1 - len]) % MOD;
    step = (step * 25) % MOD;
    cnt = ((cnt * 26) + ((cnk * step))) % MOD;
  }
}
int main() {
  cin >> m;
  cin >> st;
  len = st.length();
  for (int i = 0; i < m; i++) {
    scanf("%i", &t);
    if (t == 1) {
      cin >> st;
      len = st.length();
    } else {
      scanf("%i", &n);
      q[len].push_back(make_pair(n, i));
    }
  }
  for (int i = 0; i < m; i++) res[i] = -1;
  for (int i = 0; i < LEN; i++) power[i] = getpow(i, MOD - 2);
  for (int i = 0; i < LEN; i++) getans(q[i], i);
  for (int i = 0; i < m; i++)
    if (res[i] != -1) printf("%I64d\n", res[i]);
  return 0;
}
