#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
const int inf = 0x3f3f3f3f;
const string debug_line = "yolo";
const long long linf = 1e15 + 5;
char s[100010];
map<int, int> mp1;
map<int, int> mp2;
map<pair<int, int>, int> mp3;
map<int, long long> mp4;
int counter1 = 0;
int current = 0;
vector<int> Adj[100010];
long long f[100010];
long long invf[100010];
int queries = 0;
long long dp[100010];
long long pow25[100010];
long long pow26[100010];
long long invpow26[100010];
vector<int> v1;
long long power(long long b, long long e) {
  if (e == 0) {
    return 1LL;
  } else if (e == 1) {
    return b;
  } else {
    long long p = power(b, e / 2);
    if (e % 2 == 0) {
      return (p * p) % 1000000007;
    } else {
      p = (p * p) % 1000000007;
      p = (p * b) % 1000000007;
      return p;
    }
  }
}
void calc() {
  f[0] = 1LL;
  for (int(i) = (1); (i) < (100001); ++(i)) {
    f[i] = (f[i - 1] * i) % 1000000007;
  }
  invf[100000] = power(f[100000], 1000000007 - 2);
  for (int(i) = (99999); (i) > (-1); --(i)) {
    invf[i] = (invf[i + 1] * (i + 1)) % 1000000007;
  }
  pow25[0] = 1LL;
  for (int(i) = (1); (i) < (100001); ++(i)) {
    pow25[i] = (pow25[i - 1] * 25LL) % 1000000007;
  }
  pow26[0] = 1LL;
  for (int(i) = (1); (i) < (100001); ++(i)) {
    pow26[i] = (pow26[i - 1] * 26LL) % 1000000007;
  }
  invpow26[100000] = power(pow26[100000], 1000000007 - 2);
  for (int(i) = (99999); (i) > (-1); --(i)) {
    invpow26[i] = (invpow26[i + 1] * 26LL) % 1000000007;
  }
}
int main() {
  calc();
  int m;
  scanf("%d", &m);
  scanf("%s", s);
  int l1 = strlen(s);
  mp1[l1] = counter1++;
  mp2[counter1 - 1] = l1;
  current = l1;
  for (int(i) = (0); (i) < (m); ++(i)) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      scanf("%s", s);
      int l1 = strlen(s);
      if (mp1.count(l1) == 0) {
        mp1[l1] = counter1++;
        mp2[counter1 - 1] = l1;
      }
      current = l1;
    } else if (type == 2) {
      int first;
      scanf("%d", &first);
      Adj[mp1[current]].push_back(first);
      if (mp3.count(make_pair(current, first)) == 0) {
        mp3[make_pair(current, first)] = queries++;
      }
      v1.push_back(mp3[make_pair(current, first)]);
    }
  }
  for (int(i) = (0); (i) < (counter1); ++(i)) {
    sort(Adj[i].begin(), Adj[i].end());
    reverse(Adj[i].begin(), Adj[i].end());
    if ((int)Adj[i].size() > 0) {
      for (int(j) = (0); (j) < (Adj[i][0] + 1); ++(j)) {
        dp[j] = 0;
      }
      int begin1 = mp2[i];
      for (int(j) = (begin1); (j) < (Adj[i][0] + 1); ++(j)) {
        long long temp1 = 0;
        temp1 =
            ((f[j - 1] * invf[begin1 - 1]) % 1000000007 * invf[j - begin1]) %
            1000000007;
        temp1 = (temp1 * pow25[j - begin1]) % 1000000007;
        temp1 = (temp1 * invpow26[j]) % 1000000007;
        dp[j] = (dp[j - 1] + temp1) % 1000000007;
      }
      for (auto &(t1) : (Adj[i])) {
        mp4[mp3[make_pair(begin1, t1)]] = (dp[t1] * pow26[t1]) % 1000000007;
      }
    }
  }
  for (auto &(t1) : (v1)) {
    printf("%lld\n", mp4[t1]);
  }
  return 0;
}
