#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int N = 100 * 1000 + 2, MOD = 1000 * 1000 * 1000 + 7, SQ = 450;
string s;
long long fact[N], inv[N];
int id[N], dp[SQ][N];
inline long long Pow(long long a, long long b) {
  long long x = 1;
  while (b) {
    if (b & 1) {
      x = (x * a) % MOD;
    }
    a = (a * a) % MOD;
    b >>= 1;
  }
  return x;
}
inline long long c(int r, int n) {
  return fact[n] * inv[r] % MOD * inv[n - r] % MOD;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  int m;
  cin >> m;
  for (int i = fact[0] = 1; i < N; i++) fact[i] = fact[i - 1] * i % MOD;
  inv[N - 1] = Pow(fact[N - 1], MOD - 2);
  for (int i = N - 1; i > 0; i--) inv[i - 1] = inv[i] * i % MOD;
  for (int i = 0; i < N; i++) id[i] = -1;
  cin >> s;
  int pt = -1;
  while (m--) {
    int t;
    cin >> t;
    if (t == 1) {
      cin >> s;
    } else {
      int n;
      cin >> n;
      int sz = s.size();
      if (id[sz] == -1) {
        pt++;
        id[sz] = pt;
        dp[pt][sz] = 1;
        long long pw = 1;
        for (int i = sz + 1; i < N; i++) {
          pw = pw * 25 % MOD;
          dp[pt][i] =
              (dp[pt][i - 1] * 26ll % MOD + c(sz - 1, i - 1) * pw % MOD) % MOD;
        }
      }
      cout << dp[id[sz]][n] << '\n';
    }
  }
  return 0;
}
