#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void in(T &x) {
  x = 0;
  short f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
  x *= f;
}
template <class T>
inline void out(T x, const char c = '\n') {
  static short st[30];
  short m = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++m] = x % 10, x /= 10;
  while (x);
  while (m) putchar(st[m--] | '0');
  putchar(c);
}
template <class T, class... Args>
inline void in(T &x, Args &...args) {
  in(x);
  in(args...);
}
template <class T, class... Args>
inline void out(const T &x, const Args &...args) {
  out(x, ' ');
  out(args...);
}
template <class T>
inline void prt(T a[], int n) {
  for (register int i = 0; i < n; ++i) out(a[i], ' ');
  putchar('\n');
}
template <class T>
inline void clr(T a[], int n) {
  memset(a, 0, sizeof(T) * n);
}
template <class T>
inline void clr(T *a, T *b) {
  memset(a, 0, sizeof(T) * (b - a));
}
template <class T>
inline bool ckmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool ckmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
namespace MOD_CALC {
const int md = 1e9 + 7;
inline int add(const int a, const int b) {
  return a + b >= md ? a + b - md : a + b;
}
inline int sub(const int a, const int b) {
  return a - b < 0 ? a - b + md : a - b;
}
inline int mul(const int a, const int b) { return (long long)a * b % md; }
inline void inc(int &a, const int b) { (a += b) >= md ? a -= md : 0; }
inline void dec(int &a, const int b) { (a -= b) < 0 ? a += md : 0; }
inline int qpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a))
    if (b & 1) r = mul(r, a);
  return r;
}
inline int mdinv(const int a) { return qpow(a, md - 2); }
}  // namespace MOD_CALC
using namespace MOD_CALC;
namespace i207M {
const int Max = 1e5;
int fac[100005], ifac[100005];
int pw25[100005], pw26[100005], ipw26[100005];
void prework(int n) {
  fac[0] = 1;
  for (register int i = 1; i <= n; ++i) fac[i] = mul(fac[i - 1], i);
  ifac[n] = mdinv(fac[n]);
  for (register int i = n; i >= 1; --i) ifac[i - 1] = mul(ifac[i], i);
  pw25[0] = 1;
  for (register int i = 1; i <= n; ++i) pw25[i] = mul(pw25[i - 1], 25);
  pw26[0] = 1;
  for (register int i = 1; i <= n; ++i) pw26[i] = mul(pw26[i - 1], 26);
  ipw26[0] = 1;
  int i26 = mdinv(26);
  for (register int i = 1; i <= n; ++i) ipw26[i] = mul(ipw26[i - 1], i26);
}
void work(vector<int> &a, int m) {
  a.resize(Max + 1);
  for (register int i = m; i <= Max; ++i)
    a[i] = add(a[i - 1],
               mul(mul(fac[i - 1], ipw26[i]), mul(pw25[i - m], ifac[i - m])));
}
int n, m;
map<int, vector<int>> rem;
inline int calc(int n, int m) {
  if (n < m) return 0;
  int ans = mul(rem[m][n], mul(pw26[n], ifac[m - 1]));
  return ans;
}
signed main() {
  prework(Max);
  int cq, len, op, v;
  in(cq);
  static char s[100005];
  scanf("%s", s);
  len = strlen(s);
  work(rem[len], len);
  while (cq--) {
    in(op);
    if (op == 1) {
      scanf("%s", s), len = strlen(s);
      if (!rem.count(len)) work(rem[len], len);
    } else {
      in(v);
      out(calc(v, len));
    }
  }
  return 0;
}
}  // namespace i207M
signed main() {
  i207M::main();
  return 0;
}
