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 = 4e5 + 10;
inline long long rd() {
  long long x = 0;
  char c = getchar();
  int neg = 1;
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
int N, M, Q;
char s[maxn];
int sa[maxn], rnk[maxn], hei[maxn], rank1[maxn], tmp[maxn], cnt[maxn];
int st[maxn][22];
inline void getsa() {
  int i, j = 0, k;
  for (i = 1; i <= N; i++) cnt[s[i]] = 1;
  for (i = 1; i <= M; i++) cnt[i] += cnt[i - 1];
  for (i = N; i; i--) rnk[i] = cnt[s[i]];
  for (k = 1; j != N; k <<= 1) {
    memset(cnt, 0, sizeof(cnt));
    for (i = 1; i <= N; i++) cnt[rnk[i + k > N ? 0 : i + k]]++;
    for (i = 1; i <= M; i++) cnt[i] += cnt[i - 1];
    for (i = N; i; i--) tmp[cnt[rnk[i + k > N ? 0 : i + k]]--] = i;
    memset(cnt, 0, sizeof(cnt));
    for (i = 1; i <= N; i++) cnt[rnk[i]]++;
    for (i = 1; i <= M; i++) cnt[i] += cnt[i - 1];
    for (i = N; i; i--) sa[cnt[rnk[tmp[i]]]--] = tmp[i];
    memcpy(rank1, rnk, sizeof(rank1));
    rnk[sa[1]] = j = 1;
    for (i = 2; i <= N; i++) {
      if (rank1[sa[i]] != rank1[sa[i - 1]] ||
          rank1[sa[i] + k > N ? 0 : sa[i] + k] !=
              rank1[sa[i - 1] + k > N ? 0 : sa[i - 1] + k])
        j++;
      rnk[sa[i]] = j;
    }
    M = j;
  }
  for (i = 1; i <= N; i++) sa[rnk[i]] = i;
}
inline void geth() {
  for (int i = 1, j = 0; i <= N; i++) {
    if (rnk[i] == 1) continue;
    if (j) j--;
    int x = sa[rnk[i] - 1];
    while (x + j <= N && i + j <= N && s[x + j] == s[i + j]) j++;
    hei[rnk[i]] = j;
  }
}
inline void getst() {
  for (int i = N; i; i--) {
    st[i][0] = hei[i];
    for (int j = 1; st[i + (1 << (j - 1))][j - 1]; j++) {
      st[i][j] = min(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);
    }
  }
}
inline int rmq(int l, int r) {
  if (l > r) return N - sa[r] + 1;
  int x = log2(r - l + 1);
  return min(st[l][x], st[r - (1 << x) + 1][x]);
}
long long sum[maxn << 2], siz[maxn << 2];
bool laz[maxn << 2];
inline void update(int p) {
  sum[p] = sum[p << 1] + sum[p << 1 | 1],
  siz[p] = siz[p << 1] + siz[p << 1 | 1];
}
inline void pushdown(int p) {
  if (!laz[p]) return;
  int a = p << 1, b = p << 1 | 1;
  sum[a] = siz[a] = 0, laz[a] = 1;
  sum[b] = siz[b] = 0, laz[b] = 1;
  laz[p] = 0;
}
int erase(int p, int l, int r, int x, int y) {
  if (x <= l && r <= y) {
    int re = siz[p];
    siz[p] = sum[p] = 0;
    laz[p] = 1;
    pushdown(p);
    return re;
  } else {
    pushdown(p);
    int m = l + r >> 1, re = 0;
    if (x <= m) re = erase(p << 1, l, m, x, y);
    if (y >= m + 1) re += erase(p << 1 | 1, m + 1, r, x, y);
    update(p);
    return re;
  }
}
void add(int p, int l, int r, int x, int y) {
  if (l == r) {
    siz[p] += y, sum[p] += 1ll * y * l;
  } else {
    pushdown(p);
    int m = l + r >> 1;
    if (x <= m)
      add(p << 1, l, m, x, y);
    else
      add(p << 1 | 1, m + 1, r, x, y);
    update(p);
  }
}
inline bool cmp(int a, int b) { return rnk[a] < rnk[b]; }
int A[maxn], B[maxn];
long long solve(int k, int l) {
  sort(A + 1, A + k + 1, cmp);
  sort(B + 1, B + l + 1, cmp);
  long long re = 0;
  for (int i = k, j = l; i; i--) {
    if (i != k) {
      int x = rmq(rnk[A[i]] + 1, rnk[A[i + 1]]), t = erase(1, 0, N, x + 1, N);
      add(1, 0, N, x, t);
    }
    for (; rnk[B[j]] >= rnk[A[i]] && j; j--)
      add(1, 0, N, rmq(rnk[A[i]] + 1, rnk[B[j]]), 1);
    re += sum[1];
  }
  erase(1, 0, N, 0, N);
  for (int i = k, j = l; j; j--) {
    if (j != l) {
      int x = rmq(rnk[B[j]] + 1, rnk[B[j + 1]]), t = erase(1, 0, N, x + 1, N);
      add(1, 0, N, x, t);
    }
    for (; rnk[A[i]] > rnk[B[j]] && i; i--)
      add(1, 0, N, rmq(rnk[B[j]] + 1, rnk[A[i]]), 1);
    re += sum[1];
  }
  erase(1, 0, N, 0, N);
  return re;
}
int main() {
  int i, j, k;
  N = rd(), Q = rd();
  scanf("%s", s + 1);
  M = 128;
  getsa();
  geth();
  getst();
  for (i = 1; i <= Q; i++) {
    int a = rd(), b = rd();
    for (j = 1; j <= a; j++) A[j] = rd();
    for (j = 1; j <= b; j++) B[j] = rd();
    printf("%I64d\n", solve(a, b));
  }
  return 0;
}