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 inf = 0x3f3f3f3f, mod = 1000000007;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const double pi = acosl(-1.), eps = 1e-9;
inline int power(int a, int b, int m = mod, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
const int NN = 200020;
int n;
char s[NN];
int rk[NN * 2], mn[NN * 2][22];
int ht[NN * 2], sa[NN * 2];
int head[NN << 1];
pair<pair<int, int>, int> pos[NN << 1], buf[NN << 1], tbuf[NN << 1];
int rgt[NN << 1];
void bucket_sort(int ok, int n) {
  int i, u, j, deg, E, K;
  for (i = E = K = 0; i < max(222, n + 10); i++) head[i] = -1;
  for (i = 0; i < n; i++) {
    if (ok)
      u = pos[i].first.first + 1;
    else
      u = pos[i].first.second + 1;
    buf[E] = pos[i];
    rgt[E] = head[u];
    head[u] = E++;
  }
  for (int i = 0; i < max(n + 10, 222); i++) {
    for (deg = 0, j = head[i]; ~j; j = rgt[j]) {
      tbuf[deg++] = buf[j];
    }
    while (deg) pos[K++] = tbuf[--deg];
  }
}
void LCP(int n) {
  for (int i = 1; i <= n; i++) mn[i][0] = ht[i];
  for (int j = 1; j < 22; j++) {
    for (int i = 1; i <= n; i++) {
      mn[i][j] = min(mn[i][j - 1], mn[min(n, i + (1 << j - 1))][j - 1]);
    }
  }
}
void height(int n) {
  int h = 0, i;
  for (i = 0; i < n; i++) sa[rk[i]] = i;
  for (i = 0; i < n; i++) {
    if (rk[i] == 1) continue;
    h = max(0, h - 1);
    for (int j = sa[rk[i] - 1]; s[i + h] == s[j + h]; h++)
      ;
    ht[rk[i]] = h;
  }
}
void buildSA(int n) {
  int i, j, cnt, u;
  for (i = 0; i < n; i++) rk[i] = s[i];
  rk[n] = 0;
  for (i = 0; i < 20; i++) {
    for (j = 0; j < n; j++)
      pos[j] = pair<pair<int, int>, int>(
          pair<int, int>(rk[j], rk[min(n, j + (1 << i))]), j);
    bucket_sort(0, n);
    bucket_sort(1, n);
    pos[n] = pair<pair<int, int>, int>(pair<int, int>(-1, -1), -1);
    for (cnt = j = 0; j < n; j++) {
      rk[pos[j].second] = cnt + 1;
      cnt += (pos[j].first != pos[j + 1].first);
    }
    if (cnt == n) break;
  }
  height(n);
  LCP(n);
}
int calc(int u, int v) {
  if (u == v) return n - sa[u];
  if (u > v) swap(u, v);
  u++;
  int l = 31 - (__builtin_clz(v - u + 1));
  return min(mn[u][l], mn[v - (1 << l) + 1][l]);
}
pair<int, int> v[NN << 1];
map<int, int> cnt;
map<int, int>::iterator it;
void solve(long long ans = 0) {
  int K, L, m = 0;
  scanf("%d%d", &K, &L);
  for (int i = 0, d; i < K; i++, m++) {
    scanf("%d", &d);
    v[m].first = d - 1;
    v[m].second = 1;
  }
  for (int i = 0, d; i < L; i++, m++) {
    scanf("%d", &d);
    v[m].first = d - 1;
    v[m].second = 0;
  }
  sort(v, v + m, [](pair<int, int> a, pair<int, int> b) {
    if (a.first == b.first) return a.second < b.second;
    return rk[a.first] < rk[b.first];
  });
  long long tmp = 0;
  pair<int, int> p;
  for (int step = 2; step--;) {
    cnt.clear();
    tmp = 0;
    for (int i = 0; i < m; i++) {
      if (!v[i].second) {
        ans += tmp;
      } else {
        cnt[n - v[i].first]++;
        tmp += n - v[i].first;
      }
      if (i == m - 1) break;
      L = calc(rk[v[i].first], rk[v[i + 1].first]);
      while (!cnt.empty()) {
        it = --cnt.end();
        p = *it;
        if (p.first <= L) break;
        cnt.erase(it);
        tmp -= (long long)p.second * (p.first - L);
        cnt[L] += p.second;
      }
    }
    reverse(v, v + m);
  }
  printf("%I64d\n", ans);
}
int main() {
  int Q;
  scanf("%d%d", &n, &Q);
  scanf("%s", s);
  buildSA(n);
  for (; Q--;) solve();
  return 0;
}