#include <bits/stdc++.h>
using namespace std;
bool SR(int &_x) { return scanf("%d", &_x) == 1; }
bool SR(long long &_x) { return scanf("%lld", &_x) == 1; }
bool SR(double &_x) { return scanf("%lf", &_x) == 1; }
bool SR(char *_s) { return scanf("%s", _s) == 1; }
bool RI() { return true; }
template <typename I, typename... T>
bool RI(I &_x, T &..._tail) {
  return SR(_x) && RI(_tail...);
}
void SP(const int _x) { printf("%d", _x); }
void SP(const long long _x) { printf("%lld", _x); }
void SP(const double _x) { printf("%.16lf", _x); }
void SP(const char *s) { printf("%s", s); }
void PL() { puts(""); }
template <typename I, typename... T>
void PL(const I _x, const T... _tail) {
  SP(_x);
  if (sizeof...(_tail)) putchar(' ');
  PL(_tail...);
}
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
int fac[maxn], inv[maxn], ifac[maxn];
void predo() {
  fac[0] = 1;
  for (int i = (1); i <= int(maxn - 1); i++)
    fac[i] = 1LL * fac[i - 1] * i % MOD;
  inv[1] = 1;
  for (int i = (2); i <= int(maxn - 1); i++)
    inv[i] = 1LL * inv[MOD % i] * (MOD - MOD / i) % MOD;
  ifac[0] = 1;
  for (int i = (1); i <= int(maxn - 1); i++)
    ifac[i] = 1LL * ifac[i - 1] * inv[i] % MOD;
}
int C(int x, int y) {
  if (x < y || y < 0) return 0;
  return 1LL * fac[x] * ifac[y] % MOD * ifac[x - y] % MOD;
}
int m, len;
void getlen() {
  static char in[maxn];
  RI(in);
  len = strlen(in);
}
int n[maxn];
vector<int> has[maxn];
void read() {
  RI(m);
  getlen();
  for (int i = 0; i < int(m); i++) {
    int op;
    RI(op);
    if (op == 1)
      getlen();
    else {
      has[len].push_back(i);
      RI(n[i]);
    }
  }
}
int powmod(long long a, int b) {
  long long ret = 1;
  for (; b; b >>= 1, a = a * a % MOD)
    if (b & 1) ret = ret * a % MOD;
  return ret;
}
int sum[maxn];
void build() {
  sum[0] = 1;
  int pw = 1;
  for (int i = (1); i <= int(maxn - 1); i++) {
    long long bin = C(i - 1, len - 1);
    sum[i] = (sum[i - 1] * 26LL - bin * pw) % MOD;
    if (sum[i] < 0) sum[i] += MOD;
    if (bin > 0) pw = pw * 25LL % MOD;
  }
}
int ans[maxn];
void sol() {
  for (len = 0; len < maxn; len++)
    if (((int)(has[len]).size())) {
      build();
      for (int i : has[len]) ans[i] = sum[n[i]];
    }
  for (int i = 0; i < int(m); i++)
    if (n[i]) PL((powmod(26, n[i]) + MOD - ans[i]) % MOD);
}
int main() {
  predo();
  read();
  sol();
  return 0;
}
