Problem: The famous sculptor Cicasso is a Reberlandian spy!

These is breaking news in Berlandian papers today. And now the sculptor is hiding. This time you give the shelter to the maestro. You have a protected bunker and you provide it to your friend. You set the security system in such way that only you can open the bunker. To open it one should solve the problem which is hard for others but is simple for you.

Every day the bunker generates a codeword s. Every time someone wants to enter the bunker, integer n appears on the screen. As the answer one should enter another integer — the residue modulo 109 + 7 of the number of strings of length n that consist only of lowercase English letters and contain the string s as the subsequence.

The subsequence of string a is a string b that can be derived from the string a by removing some symbols from it (maybe none or all of them). In particular any string is the subsequence of itself. For example, the string "cfo" is the subsequence of the string "codeforces".

You haven't implemented the algorithm that calculates the correct answers yet and you should do that ASAP.

Input

The first line contains integer m (1 ≤ m ≤ 105) — the number of the events in the test case.

The second line contains nonempty string s — the string generated by the bunker for the current day.

The next m lines contain the description of the events. The description starts from integer t — the type of the event.

If t = 1 consider a new day has come and now a new string s is used. In that case the same line contains a new value of the string s.

If t = 2 integer n is given (1 ≤ n ≤ 105). This event means that it's needed to find the answer for the current string s and the value n.

The sum of lengths of all generated strings doesn't exceed 105. All of the given strings consist only of lowercase English letters.

Output

For each query of the type 2 print the answer modulo 109 + 7 on the separate line.

Example

Input

3
a
2 2
1 bc
2 5


Output

51
162626

Note

In the first event words of the form "a?" and "?a" are counted, where ? is an arbitrary symbol. There are 26 words of each of these types, but the word "aa" satisfies both patterns, so the answer is 51.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct base {
  double x, y;
  base() { x = y = 0; }
  base(double _x, double _y) { x = _x, y = _y; }
  base(double _x) { x = _x, y = 0; }
  void operator=(double _x) { x = _x, y = 0; }
  double real() { return x; }
  double imag() { return y; }
  base operator+(const base& b) { return base(x + b.x, y + b.y); }
  void operator+=(const base& b) { x += b.x, y += b.y; }
  base operator*(const base& b) {
    return base(x * b.x - y * b.y, x * b.y + y * b.x);
  }
  void operator*=(const base& b) {
    double p = x * b.x - y * b.y, q = x * b.y + y * b.x;
    x = p, y = q;
  }
  void operator/=(double k) { x /= k, y /= k; }
  base operator-(const base& b) { return base(x - b.x, y - b.y); }
  void operator-=(const base& b) { x -= b.x, y -= b.y; }
  base conj() { return base(x, -y); }
  base operator/(double k) { return base(x / k, y / k); }
  void Print() { cerr << x << " + " << y << "i\n"; }
};
double PI = 2.0 * acos(0.0);
const int maxn = 1 << 18;
base W[maxn], invW[maxn], P1[maxn], Q1[maxn];
void precompute_powers() {
  for (int i = 0; i < maxn / 2; i++) {
    double ang = (2 * PI * i) / maxn;
    double _cos = cos(ang), _sin = sin(ang);
    W[i] = base(_cos, _sin);
    invW[i] = base(_cos, -_sin);
  }
}
void fft(vector<base>& a, bool invert) {
  int n = (int)a.size();
  for (int i = 1, j = 0; i < n; ++i) {
    int bit = n >> 1;
    for (; j >= bit; bit >>= 1) j -= bit;
    j += bit;
    if (i < j) swap(a[i], a[j]);
  }
  for (int len = 2; len <= n; len <<= 1) {
    for (int i = 0; i < n; i += len) {
      int ind = 0, add = maxn / len;
      for (int j = 0; j < len / 2; ++j) {
        base u = a[i + j],
             v = (a[i + j + len / 2] * (invert ? invW[ind] : W[ind]));
        a[i + j] = (u + v);
        a[i + j + len / 2] = (u - v);
        ind += add;
      }
    }
  }
  if (invert)
    for (int i = 0; i < n; ++i) a[i] /= n;
}
void mul_big_mod(vector<long long>& a, vector<long long>& b, long long mod) {
  int n1 = a.size(), n2 = b.size();
  int final_size = a.size() + b.size() - 1;
  int n = 1;
  while (n < final_size) n <<= 1;
  vector<base> P(n), Q(n);
  long long SQRTMOD = (int)sqrt(mod) + 10;
  for (int i = 0; i < n1; i++) P[i] = base(a[i] % SQRTMOD, a[i] / SQRTMOD);
  for (int i = 0; i < n2; i++) Q[i] = base(b[i] % SQRTMOD, b[i] / SQRTMOD);
  fft(P, 0);
  fft(Q, 0);
  base A1, A2, B1, B2, X, Y;
  for (int i = 0; i < n; i++) {
    X = P[i];
    Y = P[(n - i) % n].conj();
    A1 = (X + Y) * base(0.5, 0);
    A2 = (X - Y) * base(0, -0.5);
    X = Q[i];
    Y = Q[(n - i) % n].conj();
    B1 = (X + Y) * base(0.5, 0);
    B2 = (X - Y) * base(0, -0.5);
    P1[i] = A1 * B1 + A2 * B2 * base(0, 1);
    Q1[i] = A1 * B2 + A2 * B1;
  }
  for (int i = 0; i < n; i++) P[i] = P1[i], Q[i] = Q1[i];
  fft(P, 1);
  fft(Q, 1);
  a.resize(final_size);
  for (int i = 0; i < final_size; i++) {
    long long x = (long long)(P[i].real() + 0.5);
    long long y = (long long)(P[i].imag() + 0.5) % mod;
    long long z = (long long)(Q[i].real() + 0.5);
    a[i] = (x + ((y * SQRTMOD + z) % mod) * SQRTMOD) % mod;
  }
}
const long long N = 1e5 + 10, mod = 1e9 + 7;
vector<long long> mul(vector<long long> a, vector<long long> b) {
  mul_big_mod(a, b, mod);
  return a;
}
int m, len, n[N];
char s[N];
vector<int> p[10010];
long long pw(long long x, long long p) {
  if (!p) return 1;
  long long z = pw(x, p / 2);
  z *= z;
  z %= mod;
  if (p % 2 == 0) return z;
  z *= x;
  z %= mod;
  return z;
}
long long fac[N];
long long faci[N];
vector<long long> b;
vector<long long> build(int len) {
  vector<long long> a;
  for (int i = 0; i < len; i++) {
    a.push_back(faci[i]);
  }
  return mul(a, b);
}
long long res[N];
long long pw1[N + 2];
int main() {
  precompute_powers();
  fac[0] = 1;
  faci[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = fac[i - 1] * i;
    fac[i] %= mod;
    faci[i] = pw(fac[i], mod - 2);
  }
  long long z;
  pw1[0] = 1;
  for (int i = 0; i < N; i++) {
    z = pw1[i] * faci[i];
    z %= mod;
    b.push_back(z);
    pw1[i + 1] = pw1[i] * 25;
    pw1[i + 1] %= mod;
  }
  cin >> m;
  scanf("%s", s);
  len = strlen(s);
  int t;
  map<int, int> st;
  int num = 0;
  st[len] = num++;
  for (int i = 0; i < m; i++) {
    scanf("%d", &t);
    n[i] = -1;
    if (t == 1) {
      scanf("%s", s);
      len = strlen(s);
      if (st.count(len)) continue;
      st[len] = num++;
    } else {
      scanf("%d", &n[i]);
      p[st[len]].push_back(i);
    }
  }
  int sq = 1000;
  long long r, all, n1;
  for (map<int, int>::iterator it = st.begin(); it != st.end(); it++) {
    len = it->first;
    if (it->first > sq) {
      vector<long long> ml = build(it->first);
      for (int i = 0; i < p[it->second].size(); i++) {
        int in = p[it->second][i];
        if (n[in] < len) {
          res[in] = 0;
          continue;
        }
        r = fac[n[in]] * ml[n[in]];
        r %= mod;
        all = pw(26, n[in]);
        all -= r;
        all %= mod;
        all += mod;
        all %= mod;
        res[in] = all;
      }
    } else {
      len = it->first;
      for (int i = 0; i < p[it->second].size(); i++) {
        int in = p[it->second][i];
        n1 = n[in];
        if (n[in] < len) {
          res[in] = 0;
          continue;
        }
        for (int j = 0; j < len; j++) {
          r = pw1[n1 - j] * faci[j];
          r %= mod;
          r *= faci[n1 - j];
          r %= mod;
          res[in] += r;
          if (res[in] >= mod) res[in] -= mod;
        }
        res[in] *= fac[n1];
        res[in] %= mod;
        all = pw(26, n[in]);
        all -= res[in];
        all %= mod;
        all += mod;
        all %= mod;
        res[in] = all;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if (n[i] == -1) continue;
    printf("%lld\n", res[i]);
  }
  return 0;
}