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 N = 200010, M = 1000010, P = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int INF = 0xcfcfcfcf;
const double eps = 1e-9, pi = asin(1) * 2;
int ADD(int a, int b, int p = P) { return a + b >= p ? a + b - p : a + b; }
int MINUS(int a, int b, int p = P) { return a - b < 0 ? a - b + p : a - b; }
bool debug = 0;
int n, m;
char s[N];
int sa[N], rk[N], t[N], c[N], h[N];
int a[N], b[N], n1, n2;
const int SIZE = 20;
int f[N][SIZE + 2], lg[N];
int st_query(int l, int r) {
  if (l > r) return 0;
  int t = lg[r - l + 1];
  return min(f[l][t], f[r - (1 << t) + 1][t]);
}
void Suffix_sort(int m = 'z') {
  for (int i = 0; i <= m; i++) c[i] = 0;
  for (int i = 1; i <= n; i++) c[rk[i] = s[i]]++;
  for (int i = 1; i <= m; i++) c[i] += c[i - 1];
  for (int i = n; i; i--) sa[c[rk[i]]--] = i;
  for (int len = 1; len <= n; len <<= 1) {
    int cnt = 0;
    for (int i = n - len + 1; i <= n; i++) t[++cnt] = i;
    for (int i = 1; i <= n; i++)
      if (sa[i] > len) t[++cnt] = sa[i] - len;
    for (int i = 0; i <= m; i++) c[i] = 0;
    for (int i = 1; i <= n; i++) c[rk[t[i]]]++;
    for (int i = 1; i <= m; i++) c[i] += c[i - 1];
    for (int i = n; i; i--) sa[c[rk[t[i]]]--] = t[i], t[i] = 0;
    swap(rk, t);
    rk[sa[1]] = cnt = 1;
    for (int i = 2; i <= n; i++)
      rk[sa[i]] =
          t[sa[i]] == t[sa[i - 1]] && t[sa[i] + len] == t[sa[i - 1] + len]
              ? cnt
              : ++cnt;
    if (cnt == n) break;
    m = cnt;
  }
  for (int i = 1, len = 0; i <= n; i++) {
    if (len) len--;
    int j = sa[rk[i] - 1];
    while (s[i + len] == s[j + len]) len++;
    h[rk[i]] = len;
  }
  lg[0] = -1;
  for (int i = 1; i <= n; i++) f[i][0] = h[i], lg[i] = lg[i >> 1] + 1;
  for (int j = 1; j <= SIZE; j++) {
    for (int i = 1; i <= n; i++) {
      f[i][j] = f[i][j - 1];
      if (i + (1 << j - 1) <= n)
        f[i][j] = min(f[i][j], f[i + (1 << j - 1)][j - 1]);
    }
  }
}
int lcp(int x, int y) {
  return st_query(min(rk[x], rk[y]) + 1, max(rk[x], rk[y]));
}
namespace SEGMENT_TREE {
long long sum[N << 5];
int num[N << 5], lson[N << 5], rson[N << 5], cnt = 0, rt = 0;
bool cov[N << 5];
void clear() {
  for (int i = 0; i <= cnt; i++)
    sum[i] = num[i] = lson[i] = rson[i] = cov[i] = 0;
  cnt = rt = 0;
}
void pushup(int p) {
  sum[p] = sum[lson[p]] + sum[rson[p]];
  num[p] = num[lson[p]] + num[rson[p]];
}
void update1(int p, int v, int val) {
  if (p) num[p] += v, sum[p] += 1ll * v * val;
}
void update2(int p) {
  if (p) sum[p] = 0, num[p] = 0, cov[p] = 1;
}
void pushdown(int p, int l, int r) {
  if (cov[p]) {
    update2(lson[p]), update2(rson[p]);
    cov[p] = 0;
  }
}
void update1(int &p, int l, int r, int x, int v) {
  if (!p) p = ++cnt;
  if (l == r) return update1(p, v, l);
  pushdown(p, l, r);
  int mid = l + r >> 1;
  if (x <= mid)
    update1(lson[p], l, mid, x, v);
  else
    update1(rson[p], mid + 1, r, x, v);
  pushup(p);
}
void update2(int &p, int l, int r, int ql, int qr) {
  if (!p) p = ++cnt;
  if (ql <= l && r <= qr) return update2(p);
  pushdown(p, l, r);
  int mid = l + r >> 1;
  if (ql <= mid) update2(lson[p], l, mid, ql, qr);
  if (qr > mid) update2(rson[p], mid + 1, r, ql, qr);
  pushup(p);
}
int query1(int p, int l, int r, int ql, int qr) {
  if (!p || ql > qr) return 0;
  if (ql <= l && r <= qr) return num[p];
  pushdown(p, l, r);
  int mid = l + r >> 1, ans = 0;
  if (ql <= mid) ans += query1(lson[p], l, mid, ql, qr);
  if (qr > mid) ans += query1(rson[p], mid + 1, r, ql, qr);
  return ans;
}
long long query2(int p, int l, int r, int ql, int qr) {
  if (!p || ql > qr) return 0;
  if (ql <= l && r <= qr) return sum[p];
  pushdown(p, l, r);
  int mid = l + r >> 1;
  long long ans = 0;
  if (ql <= mid) ans += query2(lson[p], l, mid, ql, qr);
  if (qr > mid) ans += query2(rson[p], mid + 1, r, ql, qr);
  return ans;
}
void Update1(int x) {
  int nn = query1(rt, 0, n, x + 1, n);
  update2(rt, 0, n, x + 1, n);
  update1(rt, 0, n, x, nn);
}
void Update2(int x) { update1(rt, 0, n, x, 1); }
long long Query() { return query2(rt, 0, n, 0, n); }
}  // namespace SEGMENT_TREE
using SEGMENT_TREE::clear;
using SEGMENT_TREE::Query;
using SEGMENT_TREE::Update1;
using SEGMENT_TREE::Update2;
struct aa {
  int x, id;
} q[N * 2];
bool operator<(const aa &a, const aa &b) { return rk[a.x] < rk[b.x]; }
long long solve() {
  int cnt = 0, p1 = 1, p2 = 1;
  long long ans = 0;
  while (p1 <= n1 && p2 <= n2) {
    if (a[p1] == b[p2]) {
      ans += n - a[p1] + 1;
      q[++cnt] = aa{a[p1], 2};
      p1++, p2++;
    } else if (a[p1] < b[p2])
      q[++cnt] = aa{a[p1++], 0};
    else
      q[++cnt] = aa{b[p2++], 1};
  }
  while (p1 <= n1) q[++cnt] = aa{a[p1++], 0};
  while (p2 <= n2) q[++cnt] = aa{b[p2++], 1};
  sort(q + 1, q + cnt + 1);
  if (debug) cerr << ans << " ";
  clear();
  for (int i = 1; i <= cnt; i++) {
    if (i > 1) Update1(lcp(q[i - 1].x, q[i].x));
    if (q[i].id != 0) ans += Query();
    if (q[i].id != 1) Update2(n - q[i].x + 1);
  }
  if (debug) cerr << ans << " ";
  clear();
  for (int i = 1; i <= cnt; i++) {
    if (i > 1) Update1(lcp(q[i - 1].x, q[i].x));
    if (q[i].id != 1) ans += Query();
    if (q[i].id != 0) Update2(n - q[i].x + 1);
  }
  if (debug) cerr << ans << "\n";
  return ans;
}
namespace IO {
long long read() {
  long long s = 0;
  bool flag = false;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') flag = true;
  for (; '0' <= ch && ch <= '9'; ch = getchar())
    s = (s << 3) + (s << 1) + (ch ^ '0');
  if (flag) return -s;
  return s;
}
}  // namespace IO
using IO::read;
int main() {
  n = read(), m = read();
  scanf("%s", s + 1);
  Suffix_sort();
  for (int i = 1; i <= m; i++) {
    n1 = read(), n2 = read();
    for (int j = 1; j <= n1; j++) a[j] = read();
    for (int j = 1; j <= n2; j++) b[j] = read();
    printf("%lld\n", solve());
  }
  return 0;
}