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>
namespace pb_ds {
namespace io {
const int MaxBuff = 1 << 15;
const int Output = 1 << 23;
char BB[MaxBuff], *S = BB, *T = BB;
char Out[Output], *iter = Out;
inline void flush() {
  fwrite(Out, 1, iter - Out, stdout);
  iter = Out;
}
}  // namespace io
template <class Type>
inline Type Read() {
  using namespace io;
  register char ch;
  register Type ans = 0;
  register bool neg = 0;
  while (ch = ((S == T) && (T = (S = BB) + fread(BB, 1, MaxBuff, stdin), S == T)
                   ? 0
                   : *S++),
         (ch < '0' || ch > '9') && ch != '-')
    ;
  ch == '-' ? neg = 1 : ans = ch - '0';
  while (ch = ((S == T) && (T = (S = BB) + fread(BB, 1, MaxBuff, stdin), S == T)
                   ? 0
                   : *S++),
         '0' <= ch && ch <= '9')
    ans = ans * 10 + ch - '0';
  return neg ? -ans : ans;
}
template <class Type>
inline void Print(register Type x, register char ch = '\n') {
  using namespace io;
  if (!x)
    *iter++ = '0';
  else {
    if (x < 0) *iter++ = '-', x = -x;
    static int s[100];
    register int t = 0;
    while (x) s[++t] = x % 10, x /= 10;
    while (t) *iter++ = '0' + s[t--];
  }
  *iter++ = ch;
}
}  // namespace pb_ds
using namespace pb_ds;
using namespace io;
using namespace std;
const int N = 3e5 + 5;
int n, k, q;
int a[N], b[N], c[N];
int sa[N], sb[N];
namespace sub1 {
const int B = 450;
const int M = (1 << 14) + 5;
int ans, tot, flag;
int cnt[B * 3][M], tag[B * 3];
int sum[B];
struct part {
  int sz;
  int L[B], R[B], id[B];
  vector<int> s;
  inline void init() {
    for (int i = 0; i < sz; ++i) R[i / B + 1] = i;
    for (int i = sz; i; --i) L[i / B + 1] = i;
    for (int i = 1; i <= (sz - 1) / B + 1; ++i) id[i] = ++tot;
    for (int i = 1; i < sz; ++i) s[i] ^= s[i - 1];
    for (int i = 0; i < sz; ++i) ++cnt[id[i / B + 1]][s[i]];
  }
  inline void query(int opt) {
    ans += opt * sz;
    for (int i = 1; i <= (sz - 1) / B + 1; ++i)
      ans -= opt * cnt[id[i]][tag[id[i]]];
  }
  inline void upd(int l, int r, int k) {
    int bl = l / B + 1, br = r / B + 1;
    for (int i = bl + 1; i < br; ++i) tag[id[i]] ^= k;
    for (int i = l; i <= R[bl] && i <= r; ++i)
      --cnt[id[bl]][s[i]], s[i] ^= k, ++cnt[id[bl]][s[i]];
    if (bl == br) return;
    for (int i = L[br]; i <= r; ++i)
      --cnt[id[br]][s[i]], s[i] ^= k, ++cnt[id[br]][s[i]];
  }
} p[B];
inline void update(int x) {
  p[x % k].query(-1);
  flag -= (sum[x % k] != 0);
  p[x % k].upd(x / k - (x % k == 0), p[x % k].sz - 1, c[x] ^ sa[x] ^ sb[x]);
  sum[x % k] ^= c[x] ^ sa[x] ^ sb[x];
  flag += (sum[x % k] != 0);
  p[x % k].query(1);
  c[x] = sa[x] ^ sb[x];
}
inline void solve() {
  for (int i = 1; i <= n; ++i)
    p[i % k].s.push_back(c[i]), ++p[i % k].sz, sum[i % k] ^= c[i];
  for (int i = 0; i < k; ++i) flag += (sum[i] != 0);
  for (int i = 0; i < k; ++i) p[i].init(), p[i].query(1);
  if (flag)
    puts("-1");
  else
    printf("%d\n", ans);
  while (q--) {
    char ch = 0;
    while (ch != 'a' && ch != 'b')
      ch = ((S == T) && (T = (S = BB) + fread(BB, 1, MaxBuff, stdin), S == T)
                ? 0
                : *S++);
    int x = Read<int>(), val = Read<int>();
    if (ch == 'a')
      a[x] = val, sa[x] = val ^ a[x - 1], sa[x + 1] = val ^ a[x + 1];
    else
      b[x] = val, sb[x] = val ^ b[x - 1], sb[x + 1] = val ^ b[x + 1];
    update(x), update(x + 1);
    if (flag)
      puts("-1");
    else
      printf("%d\n", ans);
  }
  exit(0);
}
}  // namespace sub1
namespace sub2 {
int ans, flag;
int f[N];
inline int upd(int x, int opt) {
  int sum = 0;
  for (int i = x; i <= n; i += k) sum ^= c[i], ans += opt * (sum != 0);
  return sum;
}
inline void solve() {
  ans = 0;
  for (int i = 0; i < k; ++i) f[i] = upd(i, 1), flag += (f[i] != 0);
  if (flag)
    puts("-1");
  else
    printf("%d\n", ans);
  while (q--) {
    char ch = 0;
    while (ch != 'a' && ch != 'b')
      ch = ((S == T) && (T = (S = BB) + fread(BB, 1, MaxBuff, stdin), S == T)
                ? 0
                : *S++);
    if (ch == 'a') {
      int x = Read<int>(), val = Read<int>();
      upd(x % k, -1), sa[x] = val ^ a[x - 1];
      c[x] = sa[x] ^ sb[x], flag -= (f[x % k] != 0);
      f[x % k] = upd(x % k, 1), flag += (f[x % k] != 0);
      upd((x + 1) % k, -1), sa[x + 1] = val ^ a[x + 1];
      c[x + 1] = sa[x + 1] ^ sb[x + 1], flag -= (f[(x + 1) % k] != 0);
      f[(x + 1) % k] = upd((x + 1) % k, 1), flag += (f[(x + 1) % k] != 0);
      a[x] = val;
    } else {
      int x = Read<int>(), val = Read<int>();
      upd(x % k, -1), sb[x] = val ^ b[x - 1];
      c[x] = sa[x] ^ sb[x], flag -= (f[x % k] != 0);
      f[x % k] = upd(x % k, 1), flag += (f[x % k] != 0);
      upd((x + 1) % k, -1), sb[x + 1] = val ^ b[x + 1];
      c[x + 1] = sa[x + 1] ^ sb[x + 1], flag -= (f[(x + 1) % k] != 0);
      f[(x + 1) % k] = upd((x + 1) % k, 1), flag += (f[(x + 1) % k] != 0);
      b[x] = val;
    }
    if (flag)
      puts("-1");
    else
      printf("%d\n", ans);
  }
  exit(0);
}
}  // namespace sub2
int main() {
  n = Read<int>(), k = Read<int>(), q = Read<int>();
  for (int i = 1; i <= n; ++i) sa[i] = a[i - 1] ^ (a[i] = Read<int>());
  for (int i = 1; i <= n; ++i) sb[i] = b[i - 1] ^ (b[i] = Read<int>());
  ++n, sa[n] = a[n - 1], sb[n] = b[n - 1], a[n] = b[n] = 0;
  for (int i = 1; i <= n; ++i) c[i] = sa[i] ^ sb[i];
  if (1ll * k * k <= n)
    sub1::solve();
  else
    sub2::solve();
  return 0;
}