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;
inline int re_ad() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar();
  return x * f;
}
int n, k, q;
int a[200010], b[200010], c[200010];
int sum[200010], id[200010], L[200010], f[200010], cnt;
int num[1010][16500], ans, tot;
const int K = 400;
inline void change1(int p, int v) {
  register int i;
  if (!v) return;
  for (i = p; i <= n; i += k) {
    sum[i] ^= v;
    if (sum[i] == 0) --ans;
    if (sum[i] == v) ++ans;
  }
  i = p % k + ((n - p % k) / k) * k;
  if (sum[i] == 0) --tot;
  if (sum[i] == v) ++tot;
}
inline void change2(int p, int v) {
  register int i;
  if (!v) return;
  for (i = p; id[i] == id[p]; i += k) {
    if ((sum[i] ^ f[id[p]]) == 0) ++ans;
    --num[id[p]][sum[i]];
    sum[i] ^= v;
    ++num[id[p]][sum[i]];
    if ((sum[i] ^ f[id[p]]) == 0) --ans;
  }
  for (i = id[p] + 1; i <= cnt && L[i] % k == p % k; ++i) {
    ans += num[i][f[i]];
    f[i] ^= v;
    ans -= num[i][f[i]];
  }
  i = p % k + ((n - p % k) / k) * k;
  if ((sum[i] ^ f[id[i]]) == 0) --tot;
  if ((sum[i] ^ f[id[i]]) == v) ++tot;
}
inline void change(int pla, int nu) {
  if (n / k < K)
    change1(pla, nu ^ c[pla]);
  else
    change2(pla, nu ^ c[pla]);
  c[pla] = nu;
}
int main() {
  register int i, j;
  char s[5];
  n = re_ad();
  k = re_ad();
  q = re_ad();
  for (i = 1; i <= n; ++i) a[i] = re_ad();
  for (i = 1; i <= n; ++i) b[i] = re_ad();
  ++n;
  if (n / k >= K) {
    for (i = 1; i <= k; ++i)
      for (j = i; j <= n; j += k) {
        if (((j - 1) / k + 1) % K == 1) {
          L[++cnt] = j;
          num[cnt][0] = min(K, (n - j) / k + 1);
        }
        id[j] = cnt;
      }
  }
  for (i = 1; i <= n; ++i) change(i, a[i] ^ a[i - 1] ^ b[i] ^ b[i - 1]);
  if (tot)
    puts("-1");
  else
    printf("%d\n", ans);
  while (q--) {
    scanf("%s", s + 1);
    i = re_ad();
    j = re_ad();
    if (s[1] == 'a')
      a[i] = j;
    else
      b[i] = j;
    change(i, a[i] ^ a[i - 1] ^ b[i] ^ b[i - 1]);
    if (i != n) ++i, change(i, a[i] ^ a[i - 1] ^ b[i] ^ b[i - 1]);
    if (tot)
      puts("-1");
    else
      printf("%d\n", ans);
  }
}