#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int magic = 400;
int n, k, q, ans, cnt, ndc;
int a[N], b[N], c[N], pre[N], bl[N], L[N], tag[N];
int num[1007][17000];
template <typename T>
inline void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
inline void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
inline void read(T &x) {
  T f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= f;
}
inline void upd1(int p, int v) {
  for (int i = p; i <= n; i += k) {
    pre[i] ^= v;
    if (v && pre[i] == 0) --ans;
    if (v && pre[i] == v) ++ans;
  }
  int lst = p % k + ((n - p % k) / k) * k;
  if (v && pre[lst] == 0) --cnt;
  if (v && pre[lst] == v) ++cnt;
}
inline void upd2(int p, int v) {
  for (int i = p; bl[i] == bl[p]; i += k) {
    if (v && (pre[i] ^ tag[bl[p]]) == 0) ++ans;
    --num[bl[p]][pre[i]];
    pre[i] ^= v;
    ++num[bl[p]][pre[i]];
    if (v && (pre[i] ^ tag[bl[p]]) == 0) --ans;
  }
  for (int i = bl[p] + 1; i <= ndc && L[i] % k == p % k; ++i) {
    if (v) ans += num[i][tag[i]];
    tag[i] ^= v;
    if (v) ans -= num[i][tag[i]];
  }
  int lst = p % k + ((n - p % k) / k) * k;
  if (v && (pre[lst] ^ tag[bl[lst]]) == 0) --cnt;
  if (v && (pre[lst] ^ tag[bl[lst]]) == v) ++cnt;
}
inline void modify(int p, int v) {
  if (n / k < magic)
    upd1(p, v ^ c[p]);
  else
    upd2(p, v ^ c[p]);
  c[p] = v;
}
int main() {
  read(n);
  read(k);
  read(q);
  for (int i = 1; i <= n; ++i) read(a[i]);
  for (int i = 1; i <= n; ++i) read(b[i]);
  ++n;
  if (n / k >= magic)
    for (int i = 1; i <= k; ++i)
      for (int j = i; j <= n; j += k) {
        if (((j - 1) / k + 1) % magic == 1) {
          L[++ndc] = j;
          num[ndc][0] = min(magic, (n - j) / k + 1);
        }
        bl[j] = ndc;
      }
  for (int i = 1; i <= n; ++i) modify(i, (a[i] ^ a[i - 1]) ^ (b[i] ^ b[i - 1]));
  printf("%d\n", cnt ? -1 : ans);
  while (q--) {
    char ch[5];
    int i, v;
    scanf("%s%d%d", ch, &i, &v);
    if (ch[0] == 'a')
      a[i] = v;
    else
      b[i] = v;
    modify(i, (a[i] ^ a[i - 1]) ^ (b[i] ^ b[i - 1]));
    if (i != n) modify(i + 1, (a[i + 1] ^ a[i]) ^ (b[i + 1] ^ b[i]));
    printf("%d\n", cnt ? -1 : ans);
  }
  return 0;
}
