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 = 1e6 + 5;
const int MAXM = 2e6 + 5;
struct Edge {
  int to, nxt;
  Edge() = default;
  Edge(int a, int b) : to(a), nxt(b) {}
} e[MAXM];
int head[MAXN], edge_cnt = 1;
int cnt = 1, lst = 1, ch[MAXN][26], len[MAXN], fa[MAXN], pos[MAXN];
int n, q, siz[MAXN], vis[MAXN][2], dep[MAXN], son[MAXN], st[MAXN];
int top[MAXN], in[MAXN], out[MAXN], dfn_cnt, tot, sz[MAXN][2];
long long ans;
char s[MAXN];
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
inline void add(int x, int y) {
  e[++edge_cnt] = Edge{y, head[x]};
  head[x] = edge_cnt;
}
inline void add_edge(int x, int y) { add(x, y), add(y, x); }
inline void insert(int c, int id) {
  int p = lst, np = lst = ++cnt;
  len[np] = len[p] + 1, pos[id] = np;
  while (p && !ch[p][c]) ch[p][c] = np, p = fa[p];
  if (!p) return fa[np] = 1, void();
  int q = ch[p][c];
  if (len[q] == len[p] + 1) return fa[np] = q, void();
  int nq = ++cnt;
  fa[nq] = fa[q], fa[q] = fa[np] = nq;
  len[nq] = len[p] + 1, memcpy(ch[nq], ch[q], sizeof(ch[q]));
  while (ch[p][c] == q) ch[p][c] = nq, p = fa[p];
}
void dfs_son(int x, int fath) {
  dep[x] = dep[fath] + 1;
  siz[x] = 1, fa[x] = fath;
  for (int i = head[x]; i; i = e[i].nxt) {
    int y = e[i].to;
    if (y == fath) continue;
    dfs_son(y, x), siz[x] += siz[y];
    if (siz[y] > siz[son[x]]) son[x] = y;
  }
}
void dfs_chain(int x, int tp) {
  top[x] = tp, in[x] = ++dfn_cnt;
  if (son[x]) dfs_chain(son[x], tp);
  for (int i = head[x]; i; i = e[i].nxt) {
    int y = e[i].to;
    if (y == fa[x] || y == son[x]) continue;
    dfs_chain(y, y);
  }
  out[x] = dfn_cnt;
}
inline int query_lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
inline void build(int *s, int tot) {
  auto cmp = [=](int x, int y) { return in[x] < in[y]; };
  sort(s + 1, s + tot + 1, cmp);
  for (int i = tot; i > 1; i--) s[++tot] = query_lca(s[i], s[i - 1]);
  sort(s + 1, s + tot + 1, cmp);
  tot = unique(s + 1, s + tot + 1) - s - 1;
  static int st[MAXN], top;
  top = 0;
  for (int i = 1; i <= tot; i++) {
    while (top && out[st[top]] < in[s[i]]) top--;
    if (top) add_edge(st[top], s[i]);
    st[++top] = s[i];
  }
}
void dfs_sol(int x, int fa) {
  sz[x][0] = vis[x][0], sz[x][1] = vis[x][1];
  if (sz[x][0] && sz[x][1]) ans += len[x];
  for (int i = head[x]; i; i = e[i].nxt) {
    int y = e[i].to;
    if (y == fa) continue;
    dfs_sol(y, x);
    ans += 1ll * sz[x][0] * sz[y][1] * len[x];
    ans += 1ll * sz[x][1] * sz[y][0] * len[x];
    sz[x][0] += sz[y][0], sz[x][1] += sz[y][1];
  }
  vis[x][0] = vis[x][1] = head[x] = 0;
}
inline void solve() {
  int n = read(), m = read(), tot = 0, x;
  edge_cnt = 1, ans = 0;
  for (int i = 1; i <= n; i++) x = pos[read()], vis[x][0] = 1, st[++tot] = x;
  for (int i = 1; i <= m; i++) x = pos[read()], vis[x][1] = 1, st[++tot] = x;
  build(st, tot), dfs_sol(st[1], 0), printf("%lld\n", ans);
}
inline void prepare() {
  for (int i = n; i; i--) insert(s[i] - 'a', i);
  for (int i = 2; i <= cnt; i++) add(fa[i], i);
  dfs_son(1, 0), dfs_chain(1, 1);
  memset(head, 0, sizeof(head));
}
int main() {
  n = read(), q = read();
  scanf("%s", s + 1), prepare();
  while (q--) solve();
  return 0;
}