#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int power(int a, int p) {
  if (p == 0) return 1;
  int ans = power(a, p / 2);
  ans = (1LL * ans * ans) % M;
  if (p % 2) ans = (1LL * ans * a) % M;
  return ans;
}
const int N = 1e5 + 7;
int f[N], p26[N];
int fac[N], invfac[N];
void pre() {
  fac[0] = p26[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = (1LL * fac[i - 1] * i) % M;
    p26[i] = (1LL * p26[i - 1] * 26) % M;
  }
  invfac[N - 1] = power(fac[N - 1], M - 2);
  for (int i = N - 2; i >= 0; i--)
    invfac[i] = (1LL * invfac[i + 1] * (i + 1)) % M;
  int b = (25LL * power(26, M - 2)) % M;
  int pb = 1;
  for (int i = 0; i < N; i++) {
    f[i] = (1LL * pb * invfac[i]) % M;
    pb = (1LL * pb * b) % M;
  }
}
vector<int> sol[N];
void calc(int k) {
  sol[k].resize(N);
  int sum = 0;
  for (int i = 0; k + i < N; i++) {
    sum = (sum + 1LL * fac[k + i] * f[i]) % M;
    sol[k][i] = sum;
  }
}
int solve(int n, int k) {
  if (n < 0) return 0;
  if (sol[k].empty()) calc(k);
  int ans = sol[k][n];
  ans = (1LL * ans * invfac[k]) % M;
  ans = (1LL * ans * p26[n]) % M;
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  pre();
  int t;
  cin >> t;
  string s;
  cin >> s;
  int k = s.size() - 1;
  while (t--) {
    int t;
    cin >> t;
    if (t == 1) {
      cin >> s;
      k = s.size() - 1;
    } else {
      int n;
      cin >> n;
      cout << solve(n - k - 1, k) << "\n";
    }
  }
}
