Problem: 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].

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct data {
  int x, y, id;
};
int a[200010], b[200010], c[200010], rnk[200010], tot[200010], res[200010],
    non[200010], val[200010];
vector<int> pos[200010];
vector<data> Q[200010];
int read() {
  int tmp = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    tmp = tmp * 10 + c - '0';
    c = getchar();
  }
  return tmp;
}
struct block {
  int tag[500], tl[500], tr[500], sep[200010], sum[500][20000], size, cnt, need,
      last;
  void build(int c) {
    int pre = 0;
    size = sqrt(tot[c]);
    for (int cur = 1; cur <= tot[c]; cur += size) {
      int nxt = min(cur + size - 1, tot[c]);
      cnt++;
      tl[cnt] = cur;
      tr[cnt] = nxt;
      for (int i = cur; i <= nxt; i++) {
        sep[i] = cnt;
        pre ^= val[pos[c][i]];
        val[pos[c][i]] = pre;
        sum[cnt][pre]++;
        if (pre) need++;
      }
    }
    if (pre) last = -1;
  }
  void modify(int c, int x, int y) {
    int l = tl[sep[x]], r = tr[sep[x]];
    for (int i = l; i <= r; i++) {
      int tmp = pos[c][i];
      sum[sep[x]][val[tmp]]--;
      if ((val[tmp] ^ tag[sep[x]]) == 0) need++;
      val[tmp] ^= tag[sep[x]];
      if (i >= x) val[tmp] ^= y;
      sum[sep[x]][val[tmp]]++;
      if (val[tmp] == 0) need--;
    }
    tag[sep[x]] = 0;
    for (int i = sep[x] + 1; i <= cnt; i++) {
      need += sum[i][tag[i]];
      tag[i] ^= y;
      need -= sum[i][tag[i]];
    }
    int tmp = pos[c][tot[c]];
    if ((val[tmp] ^ tag[cnt]) == 0)
      last = 0;
    else
      last = -1;
  }
  void clear(int c) {
    for (int i = 1; i <= cnt; i++) tag[i] = tl[i] = tr[i] = 0;
    for (int i = 1; i <= tot[c]; i++) sum[sep[i]][val[pos[c][i]]] = 0;
    size = cnt = need = last = 0;
  }
} B;
void solve(int c) {
  B.build(c);
  if (B.last == -1)
    non[0]++;
  else
    res[0] += B.need;
  int len = Q[c].size();
  for (int i = 0; i <= len - 1; i++) {
    data tmp = Q[c][i];
    if (B.last == -1)
      non[tmp.id]--;
    else
      res[tmp.id] -= B.need;
    B.modify(c, tmp.x, tmp.y);
    if (B.last == -1)
      non[tmp.id]++;
    else
      res[tmp.id] += B.need;
  }
  B.clear(c);
}
int main() {
  int n = read(), k = read(), q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) {
    b[i] = read();
    c[i] = a[i] ^ b[i];
  }
  for (int i = 1; i <= n + 1; i++) val[i] = c[i] ^ c[i - 1];
  for (int i = 0; i <= k - 1; i++) pos[i].push_back(0);
  for (int i = 1; i <= n + 1; i++) {
    pos[i % k].push_back(i);
    rnk[i] = ++tot[i % k];
  }
  for (int i = 1; i <= q; i++) {
    char c = getchar();
    while (c != 'a' && c != 'b') c = getchar();
    int x = read(), y = read();
    if (c == 'a') {
      y ^= a[x];
      a[x] ^= y;
    } else {
      y ^= b[x];
      b[x] ^= y;
    }
    Q[x % k].push_back((data){rnk[x], y, i});
    Q[(x + 1) % k].push_back((data){rnk[x + 1], y, i});
  }
  for (int i = 0; i <= k - 1; i++) solve(i);
  for (int i = 0; i <= q; i++) {
    if (i) {
      non[i] += non[i - 1];
      res[i] += res[i - 1];
    }
    if (non[i])
      puts("-1");
    else
      printf("%d\n", res[i]);
  }
  return 0;
}