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>
using namespace std;
const int maxn = 400500;
char s[maxn];
int fa[maxn], dfn[maxn], son[maxn], a[maxn], flag[2][maxn], sz[2][maxn],
    SZ[maxn], in[maxn], out[maxn], pos[maxn], dep[maxn], top[maxn];
int tot, idx, n, q, t;
int S[maxn];
long long ans = 0;
vector<int> g[maxn], G[maxn];
namespace SAM {
int tot, last, len[maxn], go[maxn][26];
void add(int c) {
  int p, np, q, nq;
  p = last;
  last = np = ++tot;
  len[np] = len[p] + 1;
  for (; p && !go[p][c]; p = fa[p]) go[p][c] = np;
  if (!p)
    fa[np] = 1;
  else {
    q = go[p][c];
    if (len[q] == len[p] + 1) {
      fa[np] = q;
      return;
    } else {
      nq = ++tot;
      len[nq] = len[p] + 1;
      memcpy(go[nq], go[q], sizeof(go[q]));
      fa[nq] = fa[q];
      fa[q] = fa[np] = nq;
      for (; p && go[p][c] == q; p = fa[p]) go[p][c] = nq;
    }
  }
}
void init() { tot = last = 1; }
void dfs(int u) {
  for (int i = 0; i <= 25; i++)
    if (go[u][i]) {
      printf("%d %c %d\n", u, 'a' + i, go[u][i]);
      dfs(go[u][i]);
    }
}
void build() {
  for (int i = 2; i <= tot; i++) {
    g[fa[i]].push_back(i);
  }
}
}  // namespace SAM
void dfs(int u) {
  SZ[u] = 1;
  for (auto v : g[u]) {
    if (v == fa[u]) continue;
    dep[v] = dep[u] + 1;
    dfs(v);
    SZ[u] += SZ[v];
    if (SZ[v] > SZ[son[u]]) son[u] = v;
  }
}
void make(int u, int tp) {
  in[u] = ++idx;
  top[u] = tp;
  if (son[u]) make(son[u], tp);
  for (auto v : g[u]) {
    if (v == fa[u] || v == son[u]) continue;
    make(v, v);
  }
  out[u] = idx;
}
int LCA(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  if (dep[x] < dep[y]) return x;
  return y;
}
bool cmp(int x, int y) { return in[x] < in[y]; }
void dp(int u) {
  sz[0][u] = sz[1][u] = 0;
  for (auto v : G[u]) dp(v), sz[0][u] += sz[0][v], sz[1][u] += sz[1][v];
  for (auto v : G[u]) {
    ans += 1ll * (sz[0][u] - sz[0][v]) * sz[1][v] * SAM::len[u];
  }
  ans += 1ll *
         (flag[0][u] * sz[1][u] + flag[1][u] * sz[0][u] +
          flag[0][u] * flag[1][u]) *
         SAM::len[u];
  sz[0][u] += flag[0][u];
  sz[1][u] += flag[1][u];
}
void clear(int u) {
  for (int o = 0; o <= 1; o++) sz[o][u] = flag[o][u] = 0;
  for (auto v : G[u]) clear(v);
  G[u].clear();
}
void insert(int x) {
  if (t <= 1) {
    S[++t] = x;
    return;
  }
  int lca = LCA(S[t], x);
  if (lca == S[t]) {
    S[++t] = x;
    return;
  }
  while (t > 1 && dep[S[t - 1]] >= dep[lca]) G[S[t - 1]].push_back(S[t]), --t;
  if (S[t] != lca) G[lca].push_back(S[t]), S[t] = lca;
  S[++t] = x;
}
void solve() {
  ans = 0;
  int sz[2], x, tot = 0;
  scanf("%d%d", &sz[0], &sz[1]);
  a[++tot] = 1;
  for (int o = 0; o <= 1; o++) {
    for (int i = 1; i <= sz[o]; i++) {
      scanf("%d", &x);
      a[++tot] = pos[x];
      flag[o][pos[x]] = 1;
    }
  }
  sort(a + 1, a + 1 + tot, cmp);
  tot = unique(a + 1, a + 1 + tot) - a - 1;
  t = 0;
  for (int i = 1; i <= tot; i++) insert(a[i]);
  while (t > 1) G[S[t - 1]].push_back(S[t]), --t;
  dp(1);
  clear(1);
  printf("%lld\n", ans);
}
int main() {
  scanf("%d%d", &n, &q);
  scanf("%s", s + 1);
  SAM::init();
  for (int i = n; i >= 1; i--) SAM::add(s[i] - 'a'), pos[i] = SAM::last;
  SAM::build();
  dfs(1);
  make(1, 1);
  for (int i = 1; i <= q; i++) solve();
  return 0;
}