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