Problem: Whoso in ignorance draws near to them and hears the Sirens' voice, he nevermore returns.

Homer, Odyssey

In the times of Jason and the Argonauts, it was well known that sirens use the sound of their songs to lure sailors into their demise. Yet only a few knew that every time sirens call a sailor by his name, his will weakens, making him more vulnerable. 

For the purpose of this problem, both siren songs and names of the sailors will be represented as strings of lowercase English letters. The more times the sailor's name occurs as a contiguous substring of the song, the greater danger he is in.

Jason found out that sirens can sing one of the n+1 songs, which have the following structure: let s_i (0 ≤ i ≤ n) be the i-th song and t be a string of length n, then for every i < n: s_{i+1} = s_i t_i s_i. In other words i+1-st song is the concatenation of i-th song, i-th letter (0-indexed) of t and the i-th song. 

Fortunately, he also knows s_0 and t. Jason wonders how many times a sailor's name is mentioned in a particular song. Answer q queries: given the sailor's name (w) and the index of a song (i) output the number of occurrences of w in s_i as a substring. As this number can be quite large, output its remainder modulo 10^9+7.

Input

In the first line of input there are two integers n, q (  1 ≤ n, q ≤ 10^5) meaning that there are n+1 songs and q queries. In the next two lines strings s_0 and t follow (1 ≤ |s_0| ≤ 100, |t| = n). 

Next q lines describe the queries; each one contains an integer k ( 0 ≤ k ≤ n), the index of the song sung by the sirens, and a non-empty string w, which is the name of a sailor. All strings in this problem consist only of lowercase English letters, and the sum of lengths of sailors' names does not exceed 10^6.

Output

Output q lines, i-th of them should contain the remainder modulo 10^9+7 of the number of occurrences of w in s_k.

Examples

Input


3 3
aa
bcd
2 aba
3 ca
3 aa


Output


2
2
8


Input


4 5
aba
bbac
1 a
3 baca
3 ab
2 bab
4 aba


Output


4
0
14
6
28

Note

In the first example songs of the sirens are as follows: 

  * Song 0: aa
  * Song 1: aabaa
  * Song 2: aabaacaabaa
  * Song 3: aabaacaabaadaabaacaabaa

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int M=2e6+9;
char b0[109],t[M],c[M],s[M],d[M];
int n,q,k,m,num,Ans;
int pw[M],sum[M][29];
bool pd(int l){
	num=0;
	int len=strlen(s+1);
	int r=l;
	while(r<=len){
		for(int i=r;i<r+m;++i){
			if(i>=1&&i<=len&&b0[i-r+1]!=s[i])return 0;
		}
		r+=m+1;
		if(r-1<=len)c[++num]=s[r-1];
	}
	if(num==0)Ans=(1ll*Ans+1ll*pw[k])%mod;
	return 1;
}
int solve(char *b,int len,int x){
	if(x==k&&len>1)return 0;
	if(len==0)return 0;
	if(len==1){
		int y=b[1]-'a'+1;
		return (1ll*((1ll*sum[k][y]-1ll*sum[x-1][y]*pw[k-x+1]%mod)%mod)+1ll*mod)%mod;
	}
	int cnt=0,cnt1=0,cnt2=0,l=(len+1)/2,r=len/2,ans=0;
	for(int i=1;i<=len;i+=2)d[++cnt]=b[i],cnt1+=b[i]==t[x];
	for(int i=2;i<=len;i+=2)d[++cnt]=b[i],cnt2+=b[i]==t[x];
	for(int i=1;i<=len;++i)b[i]=d[i];
	if(cnt1==l)ans=(1ll*ans+solve(b+l,r,x+1))%mod;
	if(cnt2==r)ans=(1ll*ans+solve(b,l,x+1))%mod;
	return ans;
}
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d%d",&n,&q);
	pw[0]=1;
	for(int i=1;i<=n;++i)pw[i]=2ll*pw[i-1]%mod;
	scanf("%s%s",b0+1,t+1);
	for(int i=1;i<=n;++i){
		int x=t[i]-'a'+1;
		for(int j=1;j<=26;++j){
			sum[i][j]=2ll*sum[i-1][j]%mod;
		}
		sum[i][x]=(1ll*sum[i][x]+1ll)%mod;
	}
	m=strlen(b0+1);
	for(int i=1;i<=q;++i){
		scanf("%d%s",&k,s+1);
		Ans=0;
		for(int j=1;j<=m+1;++j){
			if(pd(j-m))Ans=(1ll*Ans+1ll*solve(c,num,1))%mod;
		}
		printf("%d\n",(1ll*Ans+1ll*mod)%mod);
	}
	return 0;
}
/*
3 1
aaaa
bbd
2 abaaaa
aaaabaaaacaaaabaaaa
*/