#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class TH>
void _dbg(const char* sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char* sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[";
  for (auto& tt : V) {
    os << tt << ",";
  }
  os << "]";
  return os;
}
long long m = 0;
long long res[100010], dp[100010];
vector<pair<long long, long long> > zap[100010];
long long dl() {
  string z;
  cin >> z;
  return ((long long)(z).size());
}
const long long P = 1e9 + 7;
long long odw[100010];
long long pot(long long a, long long w) {
  long long r = 1;
  while (w) {
    if (w & 1) {
      r = r * a % P;
    }
    w /= 2;
    a = a * a % P;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  if (0) cout << fixed << setprecision(11);
  long long q;
  cin >> q;
  long long ak = dl();
  for (long long i = 0; i < q; i++) {
    long long co;
    cin >> co;
    if (co == 1) {
      ak = dl();
    } else {
      long long n;
      cin >> n;
      zap[ak].push_back({n, m++});
    }
  }
  for (long long i = 0; i < 100010; i++) odw[i] = pot(i, P - 2);
  (odw[1], odw[2]);
  for (long long dl = 0; dl < 100010; dl++) {
    if (((long long)(zap[dl]).size())) {
      for (long long i = 0; i < dl; i++) dp[i] = 0;
      long long pom = 1;
      long long sum = 0;
      for (long long i = dl; i < 100010; i++) {
        sum *= 26;
        sum += pom;
        sum %= P;
        dp[i] = sum;
        pom = (pom * 25) % P * i % P * odw[i - dl + 1] % P;
      }
      for (auto x : zap[dl]) {
        res[x.second] = dp[x.first];
      }
    }
  }
  for (long long i = 0; i < m; i++) {
    cout << res[i] << "\n";
  }
}
