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>
const int MAXN = 4e5 + 5;
template <typename _T>
void read(_T &x) {
  x = 0;
  char s = getchar();
  int f = 1;
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + (s - '0'), s = getchar();
  }
  x *= f;
}
template <typename _T>
void write(_T x) {
  if (x < 0) {
    putchar('-');
    x = (~x) + 1;
  }
  if (9 < x) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
struct edge {
  int to, nxt;
} Graph[MAXN << 1];
long long s[MAXN << 2], delt[MAXN << 2];
int tag[MAXN << 2];
int head[MAXN], siz[MAXN], heavy[MAXN], bel[MAXN], LPos[MAXN], LTail[MAXN],
    seq[MAXN];
int ch[MAXN][26], mx[MAXN], fa[MAXN], ed[MAXN];
int A[MAXN];
int N, Q, rt, lst, tot, cnt, ID, ccnt;
char S[MAXN];
void upt(const int u) { s[u] = s[u << 1] + s[u << 1 | 1]; }
void add(const int u, const int t) { s[u] += delt[u] * t, tag[u] += t; }
void copy(int a, int b) {
  mx[a] = mx[b], fa[a] = fa[b], memcpy(ch[a], ch[b], sizeof ch[b]);
}
void normalize(const int u) {
  if (tag[u]) add(u << 1, tag[u]), add(u << 1 | 1, tag[u]), tag[u] = 0;
}
void addEdge(const int from, const int to) {
  Graph[++cnt].to = to, Graph[cnt].nxt = head[from];
  head[from] = cnt;
}
void expand(const char c) {
  int x = c - 'a', p = lst, cur = ++tot;
  mx[cur] = mx[lst] + 1, lst = cur;
  while (p && !ch[p][x]) ch[p][x] = cur, p = fa[p];
  if (!p) {
    fa[cur] = rt;
    return;
  }
  int q = ch[p][x];
  if (mx[q] == mx[p] + 1) {
    fa[cur] = q;
    return;
  }
  int nq = ++tot;
  copy(nq, q);
  mx[nq] = mx[p] + 1, fa[q] = fa[cur] = nq;
  while (p && ch[p][x] == q) ch[p][x] = nq, p = fa[p];
}
void DFS1(const int u) {
  siz[u] = 1, heavy[u] = -1;
  for (int i = head[u], v; i; i = Graph[i].nxt) {
    DFS1(v = Graph[i].to), siz[u] += siz[v];
    if (heavy[u] == -1 || siz[heavy[u]] < siz[v]) heavy[u] = v;
  }
}
void DFS2(const int u) {
  LPos[u] = ++ID, seq[ID] = u;
  if (~heavy[u])
    DFS2(heavy[u]), bel[u] = bel[heavy[u]];
  else
    bel[u] = ++ccnt;
  LTail[bel[u]] = u;
  for (int i = head[u], v; i; i = Graph[i].nxt)
    if ((v = Graph[i].to) ^ heavy[u]) DFS2(v);
}
void build(const int u, const int l, const int r) {
  if (l > r) return;
  if (l == r) {
    delt[u] = mx[seq[l]] - mx[fa[seq[l]]];
    return;
  }
  int mid = l + r >> 1;
  build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
  delt[u] = delt[u << 1] + delt[u << 1 | 1];
}
void update(const int u, const int l, const int r, const int segL,
            const int segR, const int tims) {
  if (segL <= l && r <= segR) {
    add(u, tims);
    return;
  }
  if (l == r) return;
  normalize(u);
  int mid = l + r >> 1;
  if (segL <= mid) update(u << 1, l, mid, segL, segR, tims);
  if (mid < segR) update(u << 1 | 1, mid + 1, r, segL, segR, tims);
  upt(u);
}
long long query(const int u, const int l, const int r, const int segL,
                const int segR) {
  if (segL <= l && r <= segR) return s[u];
  if (l == r) return 0;
  normalize(u);
  int mid = l + r >> 1;
  long long ret = 0;
  if (segL <= mid) ret += query(u << 1, l, mid, segL, segR);
  if (segR > mid) ret += query(u << 1 | 1, mid + 1, r, segL, segR);
  return ret;
}
void change(int u, const int val) {
  while (u) {
    update(1, 1, tot, LPos[LTail[bel[u]]], LPos[u], val);
    u = fa[LTail[bel[u]]];
  }
}
long long ask(int u) {
  long long ret = 0;
  while (u) {
    ret += query(1, 1, tot, LPos[LTail[bel[u]]], LPos[u]);
    u = fa[LTail[bel[u]]];
  }
  return ret;
}
int main() {
  long long ans;
  int sizA, sizB;
  rt = lst = ++tot;
  read(N), read(Q);
  scanf("%s", S + 1);
  for (int i = N; i; i--) expand(S[i]), ed[i] = lst;
  for (int i = 2; i <= tot; i++) addEdge(fa[i], i);
  DFS1(rt);
  DFS2(rt);
  build(1, 1, tot);
  while (Q--) {
    ans = 0;
    read(sizA), read(sizB);
    for (int i = 1; i <= sizA; i++) read(A[i]), change(ed[A[i]], 1);
    for (int i = 1, p; i <= sizB; i++) read(p), ans += ask(ed[p]);
    for (int i = 1; i <= sizA; i++) change(ed[A[i]], -1);
    write(ans), putchar('\n');
  }
  return 0;
}