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>
template <typename T>
void in(T &_) {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  _ = 0;
  while (c >= '0' && c <= '9') _ = _ * 10 + c - '0', c = getchar();
}
template <typename T, typename... A>
void in(T &_, A &...a) {
  in(_);
  in(a...);
}
struct Node {
  struct Edge *head;
  int len, dep, dfn, siza, sizb;
  bool fla, flb;
  Node *f[19];
  void init() { siza = fla ? 1 : 0, sizb = flb ? 1 : 0; }
} node[400010], *pos[200010], *sta[800010];
struct Edge {
  Node *to;
  Edge *ne;
  Edge(int x, int y) : to(node + y), ne(node[x].head) {}
};
int N, Q, cnta, cntb, top;
long long ans;
std::vector<Node *> vec;
namespace SAM {
int cnt = 1, len[400010], fa[400010], ch[400010][26];
int insert(int p, int c) {
  int end = ++cnt;
  len[end] = len[p] + 1;
  for (; p && !ch[p][c]; p = fa[p]) ch[p][c] = end;
  if (!p) {
    fa[end] = 1;
    return end;
  }
  int q = ch[p][c];
  if (len[p] + 1 == len[q]) {
    fa[end] = q;
    return end;
  }
  cnt++;
  for (int i = 0; i < 26; i++) ch[cnt][i] = ch[q][i];
  fa[cnt] = fa[q];
  fa[q] = fa[end] = cnt;
  len[cnt] = len[p] + 1;
  for (; ch[p][c] == q; p = fa[p]) ch[p][c] = cnt;
  return end;
}
void build() {
  for (int i = 1; i <= cnt; i++) {
    node[i].head = new Edge(i, fa[i]);
    node[fa[i]].head = new Edge(fa[i], i);
    node[i].len = len[i];
  }
}
}  // namespace SAM
namespace LCA {
int cnt;
void dfs(Node *x, Node *fa) {
  x->dfn = ++cnt;
  for (Edge *i = x->head; i; i = i->ne)
    if (i->to != fa) {
      i->to->f[0] = x, i->to->dep = x->dep + 1;
      dfs(i->to, x);
    }
}
void init() {
  dfs(node + 1, NULL);
  for (int j = 1; j < 19; j++)
    for (int i = 1; i <= SAM::cnt; i++)
      if (node[i].f[j - 1]) node[i].f[j] = node[i].f[j - 1]->f[j - 1];
}
Node *lca(Node *x, Node *y) {
  if (x->dep < y->dep) std::swap(x, y);
  for (int i = 18; ~i; i--)
    if (x->f[i] && x->f[i]->dep >= y->dep) x = x->f[i];
  if (x == y) return x;
  for (int i = 18; ~i; i--)
    if (x->f[i] != y->f[i]) x = x->f[i], y = y->f[i];
  return x->f[0];
}
}  // namespace LCA
void update(Node *fa, Node *x) {
  long long tot = 1LL * x->siza * x->sizb;
  ans += 1LL * (x->len - fa->len) * tot;
  fa->siza += x->siza, fa->sizb += x->sizb;
}
int main() {
  char s[200010];
  in(N, Q);
  scanf("%s", s + 1);
  std::reverse(s + 1, s + N + 1);
  for (int i = 1, j = 1; i <= N; i++)
    j = SAM::insert(j, s[i] - 'a'), pos[i] = node + j;
  SAM::build();
  LCA::init();
  while (Q--) {
    for (auto i : vec) i->siza = i->sizb = 0, i->fla = i->flb = false;
    in(cnta, cntb);
    int x;
    vec.clear();
    ans = 0;
    for (int i = 1; i <= cnta; i++) {
      in(x);
      x = N - x + 1;
      pos[x]->fla = true;
      vec.push_back(pos[x]);
    }
    for (int i = 1; i <= cntb; i++) {
      in(x);
      x = N - x + 1;
      pos[x]->flb = true;
      vec.push_back(pos[x]);
    }
    std::sort(vec.begin(), vec.end(),
              [&](Node *a, Node *b) { return a->dfn < b->dfn; });
    int tmp = std::unique(vec.begin(), vec.end()) - vec.begin();
    while (vec.size() > tmp) vec.pop_back();
    sta[top = 1] = node + 1;
    node[1].init();
    for (auto i : vec)
      if (i != node + 1) {
        Node *l = LCA::lca(sta[top], i);
        if (l != sta[top]) {
          while (l->dfn < sta[top - 1]->dfn)
            update(sta[top - 1], sta[top]), top--;
          if (l->dfn > sta[top - 1]->dfn)
            l->init(), update(l, sta[top]), sta[top] = l;
          else
            update(l, sta[top--]);
        }
        i->init();
        sta[++top] = i;
      }
    while (top > 1) update(sta[top - 1], sta[top]), top--;
    printf("%I64d\n", ans);
  }
  return 0;
}