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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

/** Class: Codewords.java
 *  @author
 *  @version 1.0 <p>
 *  Course:
 *  Written / Updated: Jun 18, 2016
 *
 *  Purpose - TLE
 */
public class Codewords2 {

	private static final long MODULO = (long)Math.pow(10, 9) + 7;
	private static final int CUTOFF = 1;
	private static final int N = 100001;
	private long[] factorial;
	private long[] inv;
	private long[] powerOf25;
	private long[] powerOf26;
	private long[] ans;
	private boolean longString;
//	private HashMap<Integer[], Long> combiHM;

	public Codewords2() {
		this.factorial = new long[N];
		this.factorial[0] = 1;
		this.inv = new long[N];
		this.inv[0] = 1;
		this.powerOf25 = new long[N];
		this.powerOf26 = new long[N];
		this.powerOf25[0] = 1;
		this.powerOf26[0] = 1;
		for (int i = 1; i < N; ++i) {
			this.factorial[i] = (factorial[i-1] * i) % MODULO;
			this.inv[i] = powMod(factorial[i], MODULO - 2);
			this.powerOf25[i] = (25 * this.powerOf25[i-1]) % MODULO;
			this.powerOf26[i] = (26 * this.powerOf26[i-1]) % MODULO;
		}

//		this.combiHM = new HashMap<Integer[], Long>();

		this.ans = new long[N];

		try {
			BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));

            //Read the first line
            String line = rd.readLine();

            StringTokenizer tokenizer = new StringTokenizer(line);

            /* The number of the events in the test case. */
            int m = Integer.parseInt(tokenizer.nextToken());

            this.longString = false;

            //Read second line - a nonempty string s.
            String s = rd.readLine();
            if (s.length() > CUTOFF) {
            	prepare(s.length());
            	this.longString = true;
            }

            /* 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 <= 10^5). 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 10^5. Al of the given strings consist only of lowercase English letters. */
            for (int i = 0; i < m; i++) {
            	line = rd.readLine();
            	tokenizer = new StringTokenizer(line);
            	if (Integer.parseInt(tokenizer.nextToken()) == 1) {
            		s = tokenizer.nextToken();
            		if (s.length() > CUTOFF) {
            			prepare(s.length());
            			this.longString = true;
            		} else {
            			this.longString = false;
            		}
            	} else {
            		int n = Integer.parseInt(tokenizer.nextToken());
            		count(n, s);
            	}
            }

            rd.close();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}
	//end public Codewords

	private void prepare(int sl) {
		long base = 1;
		for (int i = 0; i < N; ++i) {
			ans[i] = i < sl ? 0 : C(i - 1, sl - 1) * base % MODULO;
			if (i >= sl) {
				base = base * 25 % MODULO;
			}
		}
		for (int i = 0; i < N; ++i) {
			if (ans[i] >= MODULO) {
				ans[i] -= MODULO;
			}
			if (i + 1 < N) {
				ans[i + 1] += ans[i] * 26 % MODULO;
			}
		}
	}

	public long powMod(long a, long b) {
		long ret = 1;
		while (b > 0) {
			if (b % 2 == 1) {
				ret = ret * a % MODULO;
			}
			a = (a * a) % MODULO;
			b >>= 1;		//equivalent to b /= 2;
		}
		return ret;
	}

	private void count(int n, String s) {
		/* Base case: if the string length is the same as the no. of blanks,
		 * there is only 1 possible such string. */
		if (s.length() == n) {
			System.out.println("1");
			return;
		}
		/* Let's say s == "ab" and n = 3. Then the question is,
		 * how many possible 3-letter strings exist that contain the subSEQUENCE (not substring) "ab"?
		 * Let's count the no. of possible positions of "a" and "b":
		 *
		 * ab_
		 * a_b
		 * _ab
		 *
		 * In sum, there are a total of C(3,2) = 3 possible positions of "a" and "b".
		 * Now, how many possible alphabet characters can go into the remaining 2 blanks in each case?
		 * Naively, we'd think that, since there are 26 alphabets, the answer would be 26 in each of the 3 cases.
		 * So we'd think the answer is 26+26+26 = 78.
		 *
		 * BUT! this results in some duplicates. For example: abb could appear multiple times, because they would be
		 * possible in each of the following cases:
		 * ab_
		 * a_b
		 *
		 * So we need to ensure that we do not double- or triple-count any duplicate strings. How can we ensure this?
		 * Consider:
		 * 1) At any point after "b", we can use any of the 26 characters we want.
		 * 2) At any point between "a" and "b" we can use any of 25 characters.
		 * 3) At any point before "a", we can use any of 25 characters.
		 *
		 * So, the answer for the above case is:
		 * ab__ : 26^2
		 * a_b_ : 25*26
		 * a__b : 25^2
		 * _ab_ : 25*26
		 * _a_b : 25^2
		 * __ab : 25^2
		 *
		 * You will see that the above strategy always works. You can test it out with a simple case:
		 *
		 * Let n = 4 and s = "ab", and the VALID CHARACTERS ARE ONLY "a" and "b". Then:
		 * ab__
		 * a_b_
		 * a__b
		 * _ab_
		 * _a_b
		 * __ab
		 *
		 * There are total of C(4,2) = 6 possible arrangements of the subsequence "a" and "b".
		 * Now, the possible no. of strings are as follows:
		 * ab__ : abaa, abab, abba, abbb
		 * a_b_ : aaba, aabb, abba, abbb
		 * a__b : aaab, aabb, abab, abbb
		 * _ab_ : aaba, aabb, baba, babb
		 * _a_b : aaab, aabb, baab, babb
		 * __ab : aaab, abab, baab, bbab
		 *
		 * Discounting all the duplicate above, we have the following number of unique strings:
		 * abaa, abab, abba, abbb, aaba, aabb, aaab, baba, babb, baab, bbab
		 * That's a total of 11 unique strings.
		 *
		 * The above result comports with our strategy, here's a simple example using
		 * 2 VALID characters in the alphabet (instead of 26 characters):
		 *
		 * ab__ : 2 blanks at the end, 2 valid characters: 	2*2 = 4
		 * a_b_ : 2 blanks, one appears before "b" :		1*2 = 2
		 * a__b : 2 blanks, both appear before "b" :		1*1 = 1
		 * _ab_ : 2 blanks, one appears before "b" : 		1*2 = 2
		 * _a_b : 2 blanks, both appear before "b" : 		1*1 = 1
		 * __ab : 2 blanks, both appear before "b" : 		1*1 = 1
		 *
		 * So that's a total of 4+2+1+2+1+1 = 11 unique strings.
		 *
		 * The above strategy can be generalized of course, for arbitrary n and arbitrary s.
		 * In fact, note that it doesn't matter what specific characters the String s consists of. The same strategy holds.
		 *
		 * The above strategy can be generalized to the following formula:
		 *
		 * Summation_{n}{k = |s|} C(k-1, |s| - 1) * (q-1)^(k-|s|) * q^(n-k)
		 *
		 * where q = the number of VALID characters.
		 *
		 * For example, when n = 4 and |s| = 2 and q = 2
		 * (e.g. s = "ab" and n = 4-character string, and q consists of "a" and "b" as in the above example we solved):
		 * Applying the above formula:
		 *
		 *   C(1,1) * (2-1)^(2-1) * 2^(4-2) + C(2,1) * (2-1)^(3-1) * 2^(4-3) + C(3,1) * (2-1)^(4-1) * 2^(4-4)
		 * = 1      *    1 ^ 1    * 2^2     + 2      *    1 ^ 2    * 2^1     + 3      *     1^ 3    * 2^0
		 * =                          4     +                        4       +                        3
		 * = 11
		 *
		 * which is exactly the same answer we got above.
		 *
		 * */
//		long q = 26;	//no. of valid alphabetic characters

		if (this.longString == true) {
			System.out.println(this.ans[n]);
			return;
		}



		long ans = powMod(26, n);
		long base = powMod(25, n - s.length() + 1);
		for (int i = s.length() - 1; i >= 0; --i) {
			ans -= (long)C(n, i) * base % MODULO;
			if (ans < 0) {
				ans += MODULO;
			}
			base = (long)base * 25 % MODULO;
		}
		System.out.println(ans);
		return;

//		long answer = 0;
//		for (int k = s.length(); k <= n; k++) {
//			answer += (((this.C(k-1, s.length() - 1) * this.powerOf25[k - s.length()]) % MODULO) * this.powerOf26[n-k]) % MODULO;
//		}
//		System.out.println(answer % MODULO);
	}

	public long C(int k, int s) {
//		long numerator = this.factorial[k];
//		long invS = this.inv[s];
//		long invS_times_s = invS * s;
//		long invKminusS = this.inv[k-s];
//		long invKminusS_times_KminusS = invKminusS * (k-s);

		return (((this.factorial[k] * this.inv[s]) % MODULO) * this.inv[k-s]) % MODULO;
	}

	public static void main(String[] args) {
		Codewords2 cw = new Codewords2();
//		System.out.println(cw.C(100, 41));
//		System.out.println(cw.powMod(3, 5));

		/* Testing out combination method */
//		System.out.println(cw.C(10,3));	//120
//		System.out.println(cw.C(11,5));	//462
//		System.out.println(cw.C(11,6));	//462
//		System.out.println(cw.C(46,44));	//1035
//		System.out.println(cw.C(5,3));	//10
//		System.out.println(cw.C(100,41));//2.011644021 * 10^28
	}

}