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 <cstdio>
#include <cstring>
#define M 1000000007
#define ll long long

int n, q, k, m;
char s0[105], t[100005], s[1000005];

int two[100005];

int cnt[100005][26];

char ss[26][1000005];

int check(int w, int len, char* s);

int solve(int w, int len, char* s) {
  if (w > k) return 0;
  int next_len = 0;
  for (int i = 0; i < len; ++i) {
    ss[w + 1][next_len++] = s[i];
    ++i;
    if (i < len && s[i] != t[w]) return 0;
  }
  if (next_len == 0) {
    return two[k - w];
  }
  if (next_len == 1) {
    int p = ss[w + 1][0] - 'a';
    return (cnt[k][p] - (ll)cnt[w][p] * two[k - w] % M + M) % M;
  }
  return check(w + 1, next_len, ss[w + 1]);
}

int check(int w, int len, char* s) {
  // printf("check %d %d\n", w, len);
  // first place is 0
  int ret = 0;
  if (s[0] == t[w]) ret = solve(w, len - 1, s + 1);
  ret += solve(w, len, s);
  return ret % M;
}

int check_s0(int base_w, int len) {
  int j = 0;
  for (int i = base_w; i < m && j < len; ++i, ++j) {
    if (s0[i] != s[j]) return 0;
  }
  int next_len = 0;
  for (; j < len;) {
    ss[1][next_len++] = s[j];
    j++;
    for (int i = 0; i < m && j < len; ++i, ++j) {
      if (s0[i] != s[j]) return 0;
    }
  }
  
  if (next_len == 0) {
    return two[k];
  }

  //printf("ok %d\n", base_w);

  return check(1, next_len, ss[1]);
}

int main() {
  scanf("%d%d", &n, &q);
  scanf("%s", s0);
  m = strlen(s0);
  scanf("%s", t + 1);

  two[0] = 1;
  for (int i = 1; i <= n; ++i)
    two[i] = two[i - 1] * 2 % M;

  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 26; ++j)
       cnt[i][j] = cnt[i - 1][j] * 2 % M;
    cnt[i][t[i] - 'a'] = (cnt[i][t[i] - 'a'] + 1) % M;
  }

  int ans = 0;
  while(q--) {
    scanf("%d", &k);
    scanf("%s", s);
    int len = strlen(s);

    ans = 0;
    for(int w = 0; w <= m; ++w) {
      ans = (ans + check_s0(w, len)) % M;
    }
    printf("%d\n", ans);
  }
}