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>
long long in() {
  long long x = 0, f = 1;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (f = -f);
  for (x = ch ^ 48; isdigit(ch = getchar());
       x = (x << 1) + (x << 3) + (ch ^ 48))
    ;
  return x * f;
}
const int maxn = 2e5 + 100;
const int inf = 0x7fffffff;
int n, m, T;
int H[maxn], c[maxn], x[maxn], y[maxn], sa[maxn], rk[maxn];
long long l[maxn], r[maxn];
char s[maxn];
int fuck1[maxn], fuck2[maxn], lg[maxn];
int f[maxn][25];
struct Tree {
 protected:
  struct node {
    node *ch[2];
    int siz, tag, l, r;
    long long val;
    node(int siz = 0, int tag = 0, int l = 0, int r = 0, long long val = 0)
        : siz(siz), tag(tag), l(l), r(r), val(val) {}
    void upd() {
      siz = ch[0]->siz + ch[1]->siz;
      val = ch[0]->val + ch[1]->val;
    }
    void clr() { siz = val = 0, tag = 1; }
    void dwn() {
      if (!tag) return;
      ch[0]->clr(), ch[1]->clr();
      tag = 0;
    }
  } * root;
  void build(node *&o, int l, int r) {
    o = new node(0, 0, l, r);
    if (l == r) return;
    int mid = (l + r) >> 1;
    build(o->ch[0], l, mid);
    build(o->ch[1], mid + 1, r);
  }
  void modify(node *o, int p, int x) {
    if (!p) return;
    if (o->r < p || o->l > p) return;
    if (o->l == o->r) return (void)(o->siz += x, o->val += 1LL * p * x);
    o->dwn();
    modify(o->ch[0], p, x);
    modify(o->ch[1], p, x);
    o->upd();
  }
  long long query(node *o, int l, int r) {
    if (o->r < l || o->l > r || l > r) return 0;
    if (l <= o->l && o->r <= r) {
      long long tmp = o->siz;
      o->clr();
      return tmp;
    }
    o->dwn();
    long long ans = query(o->ch[0], l, r) + query(o->ch[1], l, r);
    return o->upd(), ans;
  }

 public:
  void build(int len) { build(root, 1, len); }
  void lazy(int p, int x) { modify(root, p, x); }
  long long query(int l, int r) { return query(root, l, r); }
  void clr() { root->val = 0, root->siz = 0, root->tag = 1; }
  long long getans() { return root->val; }
} t;
void predoit() {
  m = 122;
  for (int i = 1; i <= n; i++) c[x[i] = s[i]]++;
  for (int i = 1; i <= m; i++) c[i] += c[i - 1];
  for (int i = n; i >= 1; i--) sa[c[x[i]]--] = i;
  for (int k = 1; k <= n; k <<= 1) {
    int num = 0;
    for (int i = n - k + 1; i <= n; i++) y[++num] = i;
    for (int i = 1; i <= n; i++)
      if (sa[i] > k) y[++num] = 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 = 1; i <= m; i++) c[i] += c[i - 1];
    for (int i = n; i >= 1; i--) sa[c[x[y[i]]]--] = y[i], y[i] = 0;
    std::swap(x, y);
    x[sa[1]] = 1, num = 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])
                     ? num
                     : ++num;
    if (num == n) break;
    m = num;
  }
  for (int i = 1; i <= n; i++) rk[i] = x[i];
  int h = 0;
  for (int i = 1; i <= n; i++) {
    if (rk[i] == 1) continue;
    if (h) h--;
    int j = sa[rk[i] - 1];
    while (j + h <= n && s[i + h] == s[j + h]) h++;
    H[rk[i]] = h;
  }
}
void work_contribute() {
  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 <= 20; j++)
    for (int i = 1; i + (1 << j) - 1 <= n; i++)
      f[i][j] = std::min(f[i][j - 1], f[i + (1 << (j - 1))][j - 1]);
}
int getans(int l, int r) {
  if (l > r)
    std::swap(l, r);
  else if (l == r)
    return n - sa[l] + 1;
  else
    l++;
  int len = lg[r - l + 1];
  return std::min(f[l][len], f[r - (1 << len) + 1][len]);
}
void query() {
  long long ans = 0;
  int nnn = in(), mmm = in();
  for (int i = 1; i <= nnn; i++) fuck1[i] = rk[in()];
  for (int i = 1; i <= mmm; i++) fuck2[i] = rk[in()];
  std::sort(fuck1 + 1, fuck1 + nnn + 1);
  std::sort(fuck2 + 1, fuck2 + mmm + 1);
  for (int i = 1, j = 1; i <= nnn; i++) {
    if (i == 1)
      t.clr();
    else {
      int lcp = getans(fuck1[i - 1], fuck1[i]), tmp = 0;
      tmp = t.query(lcp + 1, n);
      if (lcp) t.lazy(lcp, tmp);
    }
    while (j <= mmm && fuck2[j] <= fuck1[i])
      t.lazy(getans(fuck2[j], fuck1[i]), 1), j++;
    ans += t.getans();
  }
  for (int i = 1, j = 1; i <= mmm; i++) {
    if (i == 1)
      t.clr();
    else {
      int lcp = getans(fuck2[i - 1], fuck2[i]), tmp = 0;
      tmp = t.query(lcp + 1, n);
      if (lcp) t.lazy(lcp, tmp);
    }
    while (j <= nnn && fuck1[j] < fuck2[i])
      t.lazy(getans(fuck1[j], fuck2[i]), 1), j++;
    while (j <= nnn && fuck1[j] <= fuck2[i])
      t.lazy(getans(fuck1[j], fuck2[i]), 1), ans -= getans(fuck1[j], fuck2[i]),
          j++;
    ans += t.getans();
  }
  printf("%lld\n", ans);
}
int main() {
  n = in(), T = in();
  t.build(n);
  scanf("%s", s + 1);
  predoit();
  work_contribute();
  while (T-- > 0) query();
  return 0;
}