Problem: Let LCP(s, t) be the length of the longest common prefix of strings s and t. Also let s[x ... y] be the substring of s from index x to index y (inclusive). For example, if s =  "abcde", then s[1 ... 3] = "abc", s[2 ... 5] = "bcde".

You are given a string s of length n and q queries. Each query is a pair of integer sets a_1, a_2, ..., a_k and b_1, b_2, ..., b_l. Calculate ∑_{i = 1}^{i = k} ∑_{j = 1}^{j = l}{LCP(s[a_i ... n], s[b_j ... n])} for each query.

Input

The first line contains two integers n and q (1 ≤ n, q ≤ 2 ⋅ 10^5) — the length of string s and the number of queries, respectively.

The second line contains a string s consisting of lowercase Latin letters (|s| = n).

Next 3q lines contains descriptions of queries — three lines per query. The first line of each query contains two integers k_i and l_i (1 ≤ k_i, l_i ≤ n) — sizes of sets a and b respectively.

The second line of each query contains k_i integers a_1, a_2, ... a_{k_i} (1 ≤ a_1 < a_2 < ... < a_{k_i} ≤ n) — set a.

The third line of each query contains l_i integers b_1, b_2, ... b_{l_i} (1 ≤ b_1 < b_2 < ... < b_{l_i} ≤ n) — set b.

It is guaranteed that ∑_{i = 1}^{i = q}{k_i} ≤ 2 ⋅ 10^5 and ∑_{i = 1}^{i = q}{l_i} ≤ 2 ⋅ 10^5.

Output

Print q integers — answers for the queries in the same order queries are given in the input.

Example

Input

7 4
abacaba
2 2
1 2
1 2
3 1
1 2 3
7
1 7
1
1 2 3 4 5 6 7
2 2
1 5
1 5


Output

13
2
12
16

Note

Description of queries: 

  1. In the first query s[1 ... 7] = abacaba and s[2 ... 7] = bacaba are considered. The answer for the query is LCP(abacaba, abacaba) + LCP(abacaba, bacaba) + LCP(bacaba, abacaba) + LCP(bacaba, bacaba) = 7 + 0 + 0 + 6 = 13.
  2. In the second query s[1 ... 7] = abacaba, s[2 ... 7] = bacaba, s[3 ... 7] = acaba and s[7 ... 7] = a are considered. The answer for the query is LCP(abacaba, a) + LCP(bacaba, a) + LCP(acaba, a) = 1 + 0 + 1 = 2.
  3. In the third query s[1 ... 7] = abacaba are compared with all suffixes. The answer is the sum of non-zero values: LCP(abacaba, abacaba) + LCP(abacaba, acaba) + LCP(abacaba, aba) + LCP(abacaba, a) = 7 + 1 + 3 + 1 = 12.
  4. In the fourth query s[1 ... 7] = abacaba and s[5 ... 7] = aba are considered. The answer for the query is LCP(abacaba, abacaba) + LCP(abacaba, aba) + LCP(aba, abacaba) + LCP(aba, aba) = 7 + 3 + 3 + 3 = 16. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += 1000000009;
}
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 1000000009) a -= 1000000009;
}
template <typename T>
inline T const &MAX(T const &a, T const &b) {
  return a > b ? a : b;
}
template <typename T>
inline T const &MIN(T const &a, T const &b) {
  return a < b ? a : b;
}
inline long long qp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000009;
    a = a * a % 1000000009, b >>= 1;
  }
  return ans;
}
inline long long qp(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c, b >>= 1;
  }
  return ans;
}
using namespace std;
const unsigned long long ba = 233;
const double eps = 1e-5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 200000 + 10, maxn = 1000000 + 10, inf = 0x3f3f3f3f;
char s[N];
struct SAM {
  int last, cnt;
  int ch[N << 1][26], fa[N << 1], l[N << 1];
  int pos[N << 1], dep[N << 1], f[N << 1][20], dfn[N << 1], res;
  vector<int> v[N << 1];
  void ins(int c) {
    int p = last, np = ++cnt;
    last = np;
    l[np] = l[p] + 1;
    for (; p && !ch[p][c]; p = fa[p]) ch[p][c] = np;
    if (!p)
      fa[np] = 1;
    else {
      int q = ch[p][c];
      if (l[p] + 1 == l[q])
        fa[np] = q;
      else {
        int nq = ++cnt;
        l[nq] = l[p] + 1;
        memcpy(ch[nq], ch[q], sizeof(ch[q]));
        fa[nq] = fa[q];
        fa[q] = fa[np] = nq;
        for (; ch[p][c] == q; p = fa[p]) ch[p][c] = nq;
      }
    }
  }
  void build() {
    last = cnt = 1;
    int len = strlen(s + 1);
    reverse(s + 1, s + 1 + len);
    for (int i = 1; s[i]; i++) ins(s[i] - 'a'), pos[i] = last;
    for (int i = 1; i <= cnt; i++) v[fa[i]].push_back(i);
    dfs(1);
    for (int i = 1; i < 20; i++)
      for (int j = 1; j <= cnt; j++) f[j][i] = f[f[j][i - 1]][i - 1];
  }
  void dfs(int u) {
    f[u][0] = fa[u];
    dfn[u] = ++res;
    for (int x : v[u]) {
      dep[x] = dep[u] + 1;
      dfs(x);
    }
  }
  int lca(int x, int y) {
    if (dep[x] > dep[y]) swap(x, y);
    for (int i = 19; ~i; i--)
      if (((dep[y] - dep[x]) >> i) & 1) y = f[y][i];
    if (x == y) return x;
    for (int i = 19; ~i; i--)
      if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
    return f[x][0];
  }
} sam;
vector<int> v[N * 2], in;
void add1(int a, int b) {
  v[a].push_back(b), in.push_back(a);
  in.push_back(b);
}
int st[N * 2], top, a[N * 2];
long long dp[N * 2][2], ans;
void ins(int x) {
  if (!top) {
    st[++top] = x;
    return;
  }
  int lc = sam.lca(st[top], x);
  while (top > 1 && sam.dep[st[top - 1]] > sam.dep[lc])
    add1(st[top - 1], st[top]), top--;
  if (top >= 1 && sam.dep[st[top]] > sam.dep[lc]) add1(lc, st[top]), top--;
  if (!top || sam.dep[st[top]] < sam.dep[lc]) st[++top] = lc;
  st[++top] = x;
}
bool cmp(int a, int b) { return sam.dfn[a] < sam.dfn[b]; }
void dfs(int u) {
  ans += 1ll * sam.l[u] * dp[u][0] * dp[u][1];
  for (int x : v[u]) {
    dfs(x);
    ans += 1ll * sam.l[u] * dp[u][0] * dp[x][1];
    ans += 1ll * sam.l[u] * dp[x][0] * dp[u][1];
    dp[u][0] += dp[x][0], dp[u][1] += dp[x][1];
  }
}
int main() {
  int n, q;
  scanf("%d%d%s", &n, &q, s + 1);
  sam.build();
  while (q--) {
    int k, l;
    scanf("%d%d", &k, &l);
    for (int i = 0; i < k; i++) {
      scanf("%d", &a[i]), a[i] = sam.pos[n + 1 - a[i]];
      dp[a[i]][0]++;
    }
    for (int i = 0; i < l; i++) {
      scanf("%d", &a[k + i]), a[k + i] = sam.pos[n + 1 - a[k + i]];
      dp[a[k + i]][1]++;
    }
    sort(a, a + k + l, cmp);
    k += l;
    k = unique(a, a + k) - a;
    ans = top = 0;
    ins(1);
    for (int i = 0; i < k; i++)
      if (a[i] != 1) ins(a[i]);
    while (top >= 2) add1(st[top - 1], st[top]), top--;
    dfs(1);
    printf("%lld\n", ans);
    for (int x : in) v[x].clear(), dp[x][0] = dp[x][1] = 0;
    in.clear();
  }
  return 0;
}