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;
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;
}