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.*;
import java.util.*;

public class R349qC {
	
	static final int mod = (int)1e9 + 7;
	static long fact[];
	static long inv[];
	static long _25[], _26[];
	
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		final int c = (int)1e5 + 10;
		
		fact = new long[c];
		fact[0] = 1;
		for(int i = 1; i < c; i++)
			fact[i] = (i * fact[i - 1]) % mod;
		
		inv = new long[c];
		for(int i = 0; i < c; i++)
			inv[i] = pow(fact[i], mod - 2);
		
		_25 = new long[c];
		_25[0] = 1;
		for(int i = 1; i < c; i++)
			_25[i] = (25 * _25[i - 1]) % mod;
		
		_26 = new long[c];
		_26[0] = 1;
		for(int i = 1; i < c; i++)
			_26[i] = (26 * _26[i - 1]) % mod;
		
		int m = in.nextInt();
		
		TreeSet<Integer> set = new TreeSet<Integer>();
		
		int first = in.readString().length();
		set.add(first);
		
		int a[] = new int[m];
		int b[] = new int[m];
		
		for(int i = 0; i < m; i++){
			a[i] = in.nextInt();
			if(a[i] == 2)
				b[i] = in.nextInt();
			else{
				b[i] = in.readString().length();
				set.add(b[i]);
			}
		}
		
		int map[] = new int[c];
		int val[] = new int[set.size()];
		int ptr = 0;
		for(int x : set){
			map[x] = ptr;
			val[ptr++] = x;
		}
		
		int dp[][] = new int[val.length][c];
			
		for(int i = 0; i < val.length; i++){
			int x = val[i];
			for(int j = x; j < c; j++){
				dp[i][j] = (int)((26L * dp[i][j - 1]) % mod);
				long now = C(j - 1, x - 1);
				now *= _25[j - x];
				now %= mod;
				dp[i][j] += now;
				if(dp[i][j] >= mod)
					dp[i][j] -= mod;
			}
		}
		
		int curr = first;
		
		for(int i = 0; i < m; i++){
			if(a[i] == 2){
				w.println(dp[map[curr]][b[i]]);
			}
			else{
				curr = b[i];
			}
		}
		
		w.close();
	}
	
	static long pow(long a, int b){
		if(b == 0)
			return 1;
		long t = pow(a,b >> 1);
		t = (t * t) % mod;
		if( (b & 1) != 0 )
			t = (t * a) % mod;
		return t;
	}
	
	static long C(int n, int r){
		if(r > n || r < 0)
			return 0;
		return (((fact[n] * inv[r]) % mod) * inv[n - r]) % mod;
	}

	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}