The Fair Nut has two arrays a and b, consisting of n numbers. He found them so long ago that no one knows when they came to him.

The Fair Nut often changes numbers in his arrays. He also is interested in how similar a and b are after every modification.

Let's denote similarity of two arrays as the minimum number of operations to apply to make arrays equal (every operation can be applied for both arrays). If it is impossible, similarity will be equal -1.

Per one operation you can choose a subarray with length k (k is fixed), and change every element a_i, which belongs to the chosen subarray, to a_i ⊕ x (x can be chosen), where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). 

Nut has already calculated the similarity of the arrays after every modification. Can you do it?

Note that you just need to calculate those values, that is you do not need to apply any operations.

Input

The first line contains three numbers n, k and q (1 ≤ k ≤ n ≤ 2 ⋅ 10^5, 0 ≤ q ≤ 2 ⋅ 10^5) — the length of the arrays, the length of the subarrays, to which the operations are applied, and the number of queries.

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i < 2^{14}) — elements of array a.

The third line contains n integers b_1, b_2, …, b_n (0 ≤ b_i < 2^{14}) — elements of array b.

Each of the next q lines describes query and contains string s and two integers p and v (1 ≤ p ≤ n, 0 ≤ v < 2^{14}) — array, which this query changes («a» or «b» without quotes), index of changing element and its new value.

Output

On the first line print initial similarity of arrays a and b.

On the i-th of following q lines print similarity of a and b after applying first i modifications.

Examples

Input

3 3 1
0 4 2
1 2 3
b 2 5


Output

-1
1


Input

3 2 2
1 3 2
0 0 0
a 1 0
b 1 1


Output

2
-1
2

Note

In the first sample making arrays [0, 4, 2] and [1, 2, 3] is impossible with k=3. After the modification, you can apply the operation with x=1 to the whole first array (its length is equal to k), and it will be equal to the second array.

In order to make arrays equal in the second sample before changes, you can apply operations with x=1 on subarray [1, 2] of a and with x=2 on subarray [2, 3] of b.

After all queries arrays will be equal [0, 3, 2] and [1, 0, 0]. The same operations make them equal [1, 2, 2].
#include <bits/stdc++.h>
using namespace std;
int get() {
  char ch;
  while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-')
    ;
  if (ch == '-') {
    int s = 0;
    while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0';
    return -s;
  }
  int s = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0';
  return s;
}
const int N = 2e5 + 5;
const int B = 500;
const int L = (1 << 14) + 5;
int n, q;
int a[N], b[N], c[N], d[N];
int k;
int cnt[B][L];
int blk;
int st[N], ed[N], len;
int que[N], pos[N], be[N], u;
int all[N], val[N];
int sum[N];
int ans, wr;
int lef[N], rig[N];
void change(int x, int v) {
  d[x] ^= v;
  int w = pos[x];
  int res = x % k;
  if (all[res])
    wr--;
  else
    ans -= val[res];
  if (be[w]) {
    int p = be[w];
    sum[p] = 0;
    for (int i = lef[p]; i <= rig[p]; i++) {
      sum[p] ^= d[que[i]];
      if (i >= w)
        cnt[p][sum[p] ^ v]--;
      else
        cnt[p][sum[p]]--;
      cnt[p][sum[p]]++;
    }
  }
  all[res] = val[res] = 0;
  int L = st[res];
  for (; L + blk - 1 <= ed[res]; L += blk) {
    int R = L + blk - 1;
    int p = be[L];
    val[res] += cnt[p][all[res]];
    all[res] ^= sum[p];
  }
  for (; L <= ed[res]; L++) {
    all[res] ^= d[que[L]];
    if (!all[res]) val[res]++;
  }
  if (all[res])
    wr++;
  else
    ans = ans + val[res];
}
int main() {
  n = get();
  k = get();
  q = get();
  for (int i = 1; i <= n; i++) a[i] = get();
  for (int i = 1; i <= n; i++) b[i] = get();
  for (int i = 1; i <= n; i++) c[i] = a[i] ^ b[i];
  for (int i = 1; i <= n + 1; i++) d[i] = c[i] ^ c[i - 1];
  blk = sqrt(n);
  for (int res = 0; res <= k - 1; res++) {
    st[res] = len + 1;
    for (int i = res == 0 ? k : res; i <= n + 1; i += k) que[++len] = i;
    ed[res] = len;
  }
  for (int i = 1; i <= n + 1; i++) pos[que[i]] = i;
  ans = 0, wr = 0;
  for (int res = 0; res <= k - 1; res++) {
    for (int L = st[res]; L + blk - 1 <= ed[res]; L += blk) {
      int R = L + blk - 1;
      lef[++u] = L;
      rig[u] = R;
      for (int i = L; i <= R; i++) {
        be[i] = u;
        sum[u] ^= d[que[i]];
        cnt[u][sum[u]]++;
      }
    }
    for (int i = st[res]; i <= ed[res]; i++) {
      all[res] ^= d[que[i]];
      if (!all[res]) val[res]++;
    }
    if (all[res])
      wr++;
    else
      ans = ans + val[res];
  }
  if (wr)
    printf("-1\n");
  else
    printf("%d\n", n + 1 - ans);
  for (int _ = 1; _ <= q; _++) {
    char s[10];
    scanf("%s", s);
    int x = get(), v = get();
    if (s[0] == 'a') {
      v ^= a[x];
      a[x] ^= v;
    } else {
      v ^= b[x];
      b[x] ^= v;
    }
    c[x] ^= v;
    change(x, v);
    change(x + 1, v);
    if (wr)
      printf("-1\n");
    else
      printf("%d\n", n + 1 - ans);
  }
  return 0;
}
