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 long long N = 2e5 + 1;
long long arr[N];
long long pos[N];
long long lcp[N];
namespace Suffix_Array {
void SA(string s) {
  s += "$";
  long long n = s.size();
  vector<long long> p(n);
  vector<long long> c(n);
  vector<long long> cnt(max(256ll, n), 0);
  for (char C : s) cnt[C]++;
  for (long long i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
  for (long long i = 0; i < n; ++i) p[--cnt[s[i]]] = i;
  c[p[0]] = 0;
  long long lop = 1;
  for (long long i = 1; i < n; ++i) {
    if (s[p[i]] != s[p[i - 1]]) ++lop;
    c[p[i]] = lop - 1;
  }
  vector<long long> pn(n);
  vector<long long> cn(n);
  for (long long k = 1; k < n; k <<= 1) {
    for (long long i = 0; i < n; ++i) pn[i] = (p[i] - k + n) % n;
    fill(cnt.begin(), cnt.begin() + lop, 0);
    for (long long i = 0; i < n; ++i) cnt[c[pn[i]]]++;
    for (long long i = 1; i < lop; ++i) cnt[i] += cnt[i - 1];
    for (long long i = n - 1; i >= 0; --i) p[--cnt[c[pn[i]]]] = pn[i];
    cn[p[0]] = 0;
    lop = 1;
    for (long long i = 1; i < n; ++i) {
      if (c[p[i]] != c[p[i - 1]] || c[(p[i] + k) % n] != c[(p[i - 1] + k) % n])
        ++lop;
      cn[p[i]] = lop - 1;
    }
    c.swap(cn);
  }
  p.erase(p.begin());
  n--;
  for (long long i = 0; i < n; ++i) arr[i] = p[i], pos[p[i]] = i;
}
void work(string s) {
  SA(s);
  long long n = s.size();
  long long len = 0;
  for (long long i = 0; i < n; ++i) {
    if (pos[i] == n - 1) continue;
    while (i + len < n && arr[pos[i] + 1] + len < n &&
           s[i + len] == s[arr[pos[i] + 1] + len])
      ++len;
    lcp[pos[i]] = len;
    len = max(0ll, len - 1);
  }
}
};  // namespace Suffix_Array
long long it[N << 2];
long long lz[N << 2];
void push(long long i, long long l, long long r) {
  if (lz[i] < 0) return;
  it[i] = (r - l + 1) * lz[i];
  if (l != r) {
    lz[i << 1] = lz[i];
    lz[i << 1 | 1] = lz[i];
  }
  lz[i] = -1;
}
void upd(long long i, long long l, long long r, long long L, long long R,
         long long v) {
  push(i, l, r);
  if (l > R || r < L) return;
  if (L <= l && r <= R) {
    lz[i] = v;
    push(i, l, r);
    return;
  }
  long long m = (l + r) / 2;
  upd(i << 1, l, m, L, R, v);
  ++m;
  upd(i << 1 | 1, m, r, L, R, v);
  it[i] = it[i << 1] + it[i << 1 | 1];
}
long long n, q;
string s;
long long rmq[N][20];
long long get(long long l, long long r) {
  if (l == r) return n - arr[l];
  if (l > r) swap(l, r);
  long long k = log2(r - l);
  return min(rmq[l][k], rmq[r - (1 << k)][k]);
}
bool Q = 0;
bool cmp(long long x, long long y) { return (Q ^ (x <= y)); }
long long a[N], b[N];
void work() {
  long long n1, n2;
  cin >> n1 >> n2;
  for (long long i = 1; i <= n1; ++i) cin >> a[i], a[i] = pos[a[i] - 1];
  for (long long i = 1; i <= n2; ++i) cin >> b[i], b[i] = pos[b[i] - 1];
  sort(a + 1, a + 1 + n1);
  sort(b + 1, b + 1 + n2);
  long long ans = 0;
  for (long long t = 0; t < 2; ++t) {
    long long p = 0;
    upd(1, 1, n2, 1, n2, 0);
    for (long long i = 1; i <= n1; ++i) {
      if (i > 1) {
        long long x = get(a[i - 1], a[i]);
        long long l = 1, r = p + 1;
        while (l < r) {
          long long m = (l + r) / 2;
          if (get(b[m], a[i - 1]) >= x)
            r = m;
          else
            l = m + 1;
        }
        upd(1, 1, n2, l, p, x);
      }
      while (p < n2 && cmp(b[p + 1], a[i])) {
        ++p;
        upd(1, 1, n2, p, p, get(b[p], a[i]));
      }
      ans += it[1];
    }
    reverse(a + 1, a + 1 + n1);
    reverse(b + 1, b + 1 + n2);
    Q ^= 1;
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q >> s;
  Suffix_Array::work(s);
  for (long long i = 0; i < n; ++i) rmq[i][0] = lcp[i];
  for (long long i = 0; i < 18; ++i)
    for (long long j = 0; j + (2 << i) <= n; ++j)
      rmq[j][i + 1] = min(rmq[j][i], rmq[j + (1 << i)][i]);
  while (q--) work();
}