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 __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;
template <typename T>
inline void read(T &x) {
  char ch, t = 0;
  x = 0;
  while (!isdigit(ch = (iS == iT
                            ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                               (iS == iT ? EOF : *iS++))
                            : *iS++)))
    t |= ch == '-';
  while (isdigit(ch))
    x = x * 10 + (ch ^ 48),
    ch = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                      (iS == iT ? EOF : *iS++))
                   : *iS++);
  x = t ? -x : x;
}
inline int read_int() {
  int x;
  return read(x), x;
}
inline long long read_ll() {
  long long x;
  return read(x), x;
}
template <typename T>
inline void chkmin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
inline void chkmax(T &a, T b) {
  a = a > b ? a : b;
}
const int MAXN = 200010;
char s[MAXN];
int x[MAXN];
int y[MAXN];
int c[MAXN];
int sa[MAXN];
int rk[MAXN];
int ht[MAXN];
int Log[MAXN];
int ST[MAXN][19];
inline void GetSa(int n, int m) {
  for (int i = 1; i <= n; i++) c[x[i] = s[i]]++;
  for (int i = 2; i <= m; i++) c[i] += c[i - 1];
  for (int i = n; i >= 1; i--) sa[c[x[i]]--] = i;
  for (int k = 1, jsq = 0; k <= n; k <<= 1, jsq = 0) {
    for (int i = n - k + 1; i <= n; i++) y[++jsq] = i;
    for (int i = 1; i <= n; i++)
      if (sa[i] > k) y[++jsq] = sa[i] - k;
    for (int i = 1; i <= m; i++) c[i] = 0;
    for (int i = 1; i <= n; i++) c[x[i]]++;
    for (int i = 2; i <= m; i++) c[i] += c[i - 1];
    for (int i = n; i >= 1; i--) sa[c[x[y[i]]]--] = y[i];
    swap(x, y), x[sa[1]] = jsq = 1;
    for (int i = 2; i <= n; i++)
      x[sa[i]] = y[sa[i]] == y[sa[i - 1]] && y[sa[i] + k] == y[sa[i - 1] + k]
                     ? jsq
                     : ++jsq;
    if (jsq == n) break;
    m = jsq;
  }
  for (int i = 1; i <= n; i++) rk[sa[i]] = i;
  for (int i = 1, j, k = 0; i <= n; i++) {
    if (rk[i] == 1) continue;
    j = sa[rk[i] - 1], k -= k > 0;
    while (i + k <= n && j + k <= n && s[i + k] == s[j + k]) ++k;
    ht[rk[i]] = ST[rk[i]][0] = k;
  }
  for (int i = 2; i <= n; i++) Log[i] = Log[i >> 1] + 1;
  for (int i = 1; i <= 18; i++)
    for (int j = 1; j <= n; j++)
      ST[j][i] = min(ST[j][i - 1], ST[min(n, j + (1 << (i - 1)))][i - 1]);
}
inline int Qmin(int l, int r) {
  ++l;
  if (l > r) return 114514;
  int lg = Log[r - l + 1];
  return min(ST[l][lg], ST[r - (1 << lg) + 1][lg]);
}
int a[MAXN];
int b[MAXN];
struct Node {
  int h, l;
  Node() {}
  Node(int h, int l) : h(h), l(l) {}
  inline long long val() { return 1LL * h * l; }
} S1[MAXN], S2[MAXN];
int top1, top2;
int lp, H, len;
long long Sum1, Sum2;
int n, q;
inline void doit(int x) {
  H = Qmin(lp, x), lp = x;
  len = 0;
  while (top1 && S1[top1].h > H)
    len += S1[top1].l, Sum1 -= S1[top1].val(), --top1;
  if (len) S1[++top1] = Node(H, len), Sum1 += S1[top1].val();
  len = 0;
  while (top2 && S2[top2].h > H)
    len += S2[top2].l, Sum2 -= S2[top2].val(), --top2;
  if (len) S2[++top2] = Node(H, len), Sum2 += S2[top2].val();
}
inline void insert1(int p) {
  int len = n - sa[p] + 1;
  S1[++top1] = Node(len, 1);
  Sum1 += len;
}
inline void insert2(int p) {
  int len = n - sa[p] + 1;
  S2[++top2] = Node(len, 1);
  Sum2 += len;
}
int main() {
  n = read_int(), q = read_int();
  for (int i = 1; i <= n; i++) {
    char ch = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                           (iS == iT ? EOF : *iS++))
                        : *iS++);
    while (!isalpha(ch))
      ch = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                        (iS == iT ? EOF : *iS++))
                     : *iS++);
    s[i] = ch;
  }
  GetSa(n, 127);
  for (int QwQ = 1; QwQ <= q; QwQ++) {
    int n1 = read_int(), n2 = read_int();
    for (int i = 1; i <= n1; i++) a[i] = rk[read_int()];
    for (int i = 1; i <= n2; i++) b[i] = rk[read_int()];
    sort(a + 1, a + 1 + n1), sort(b + 1, b + 1 + n2);
    a[n1 + 1] = b[n2 + 1] = 1919810, lp = 1;
    long long res = top1 = top2 = Sum1 = Sum2 = 0;
    int i = 1, j = 1;
    while (i <= n1 || j <= n2) {
      int p = min(a[i], b[j]);
      if (a[i] == b[j]) res += n - sa[a[i]] + 1;
      doit(p);
      if (a[i] == p) res += Sum2;
      if (b[j] == p) res += Sum1;
      if (a[i] == p) insert1(a[i]), ++i;
      if (b[j] == p) insert2(b[j]), ++j;
    }
    printf("%lld\n", res);
  }
  return 0;
}