#include <bits/stdc++.h>
using namespace std;
const int mxN = 2e5, MG1 = 500, bs = 500, mxM = 1 << 14;
int n, k, q, a[mxN + 1], b[mxN + 1], c[mxN + 1], a1, a2, pi, vi;
char qt;
void ca(int x, bool b) {
  a1 += x;
  a2 += b * x;
}
struct cancer {
  int n;
  vector<int> v, lz;
  vector<vector<int>> c;
  void bld(vector<int> &v) {
    this->v = v;
    n = v.size();
    lz = vector<int>((n - 1) / bs + 1);
    c = vector<vector<int>>((n - 1) / bs + 1, vector<int>(mxM));
    for (int i = 0; i < n; ++i) ++c[i / bs][v[i]];
  }
  void upd(int l, int x) {
    for (int i = l / bs * bs; i < min(n, (l / bs + 1) * bs); ++i) {
      --c[l / bs][v[i]];
      v[i] ^= lz[l / bs];
      ++c[l / bs][v[i]];
    }
    lz[l / bs] = 0;
    for (; l % bs && l < n; ++l) {
      --c[l / bs][v[l]];
      ca(-(v[l] > 0), l == n - 1);
      v[l] ^= x;
      ++c[l / bs][v[l]];
      ca(v[l] > 0, l == n - 1);
    }
    a2 -= (v[n - 1] ^ lz[(n - 1) / bs]) > 0;
    for (; l < n; l += bs) {
      a1 += c[l / bs][lz[l / bs]];
      lz[l / bs] ^= x;
      a1 -= c[l / bs][lz[l / bs]];
    }
    a2 += (v[n - 1] ^ lz[(n - 1) / bs]) > 0;
  }
} cs[MG1];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> q;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    cin >> b[i];
    c[i - 1] = a[i] ^ a[i - 1] ^ b[i] ^ b[i - 1];
    if (i > k) c[i - 1] ^= c[i - 1 - k];
    ca(c[i - 1] > 0, i - 1 + k > n);
  }
  c[n] = c[n - k] ^ a[n] ^ b[n];
  ca(c[n] > 0, 1);
  if (k <= MG1) {
    for (int i = 0; i < k; ++i) {
      vector<int> v;
      for (int j = i; j <= n; j += k) v.push_back(c[j]);
      cs[i].bld(v);
    }
  }
  cout << (a2 ? -1 : a1) << "\n";
  while (q--) {
    cin >> qt >> pi >> vi, --pi;
    if (qt == 'a') {
      vi ^= a[pi + 1];
      a[pi + 1] ^= vi;
    } else {
      vi ^= b[pi + 1];
      b[pi + 1] ^= vi;
    }
    if (k > MG1) {
      for (int i = pi; i <= n; i += k) {
        ca(-(c[i] > 0), i + k > n);
        c[i] ^= vi;
        ca(c[i] > 0, i + k > n);
        if (i + 1 <= n) {
          ca(-(c[i + 1] > 0), i + 1 + k > n);
          c[i + 1] ^= vi;
          ca(c[i + 1] > 0, i + 1 + k > n);
        }
      }
    } else {
      cs[pi % k].upd(pi / k, vi);
      cs[(pi + 1) % k].upd((pi + 1) / k, vi);
    }
    cout << (a2 ? -1 : a1) << "\n";
  }
}
