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