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;
using ll = int64_t;
auto& errStream = cerr;
class CerrDummy {
} cerrDummy;
template <class T>
CerrDummy& operator<<(CerrDummy& cd, const T&) {
  return cd;
}
using charTDummy = char;
using traitsDummy = char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy& cd,
                      basic_ostream<charTDummy, traitsDummy>&(
                          basic_ostream<charTDummy, traitsDummy>&)) {
  return cd;
}
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (int i = int(0); i < int((int)v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
template <int i, class T>
void print_tuple(ostream&, const T&) {}
template <int i, class T, class H, class... Args>
void print_tuple(ostream& os, const T& t) {
  if (i) os << ",";
  os << get<i>(t);
  print_tuple<i + 1, T, Args...>(os, t);
}
template <class... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  os << "(";
  print_tuple<0, tuple<Args...>, Args...>(os, t);
  return os << ")";
}
ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}
template <class T>
void print(const vector<T>& v) {
  for (int i = int(0); i < int(v.size()); i++)
    print(v[i], i == int(v.size()) - 1 ? 1 : 2);
}
string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}
char* readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char* ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}
template <class T, class U>
void chmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void chmin(T& a, U b) {
  if (b < a) a = b;
}
template <class T>
T Sq(const T& t) {
  return t * t;
}
void Yes(bool ex = true) {
  cout << "YES" << endl;
  if (ex) exit(0);
}
void No(bool ex = true) {
  cout << "NO" << endl;
  if (ex) exit(0);
}
const ll infLL = LLONG_MAX / 3;
const int inf = INT_MAX / 2 - 100;
constexpr ll TEN(int n) { return n == 0 ? 1 : TEN(n - 1) * 10; }
template <class T>
vector<T> Uniqued(const vector<T>& vv) {
  auto v(vv);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  return v;
}
template <class T>
void MakeUniqued(vector<T>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
const int B = 300;
const int V = 1 << 14;
struct Rng {
  int n, last, s;
  vi raw, off, cnt;
  void Init(vi data) {
    n = data.size() - 1;
    for (int i = int(0); i < int(n); i++) data[i + 1] ^= data[i];
    last = data[n];
    raw = data;
    raw.pop_back();
    s = n / B;
    off.resize(s);
    cnt.resize(s * V);
    for (int i = int(0); i < int(s); i++)
      for (int j = int(i * B); j < int((i + 1) * B); j++) cnt[i * V + raw[j]]++;
  }
  void Change(int i, int v) {
    cerrDummy << i << " " << v << endl;
    last ^= v;
    if (i < n) {
      int p = i / B;
      if (p < s) {
        for (int j = int(i); j < int((p + 1) * B); j++) {
          cnt[p * V + raw[j]]--;
          raw[j] ^= v;
          cnt[p * V + raw[j]]++;
        }
        for (int j = int(p + 1); j < int(s); j++) off[j] ^= v;
        for (int j = int(s * B); j < int(n); j++) raw[j] ^= v;
      } else {
        for (int j = int(i); j < int(n); j++) raw[j] ^= v;
      }
    }
  }
  int GetCost() {
    if (last) return TEN(9);
    cerrDummy << s << " " << n << " " << raw << endl;
    int ans = 0;
    for (int i = int(0); i < int(s); i++) ans += cnt[i * V + off[i]];
    for (int i = int(s * B); i < int(n); i++)
      if (raw[i] == 0) ans++;
    return n - ans;
  }
};
signed main() {
  int n = read(), k = read(), qs = read();
  vi aRaw(n), bRaw(n);
  for (int i = int(0); i < int(n); i++) aRaw[i] = read();
  for (int i = int(0); i < int(n); i++) bRaw[i] = read();
  vi raw(n);
  for (int i = int(0); i < int(n); i++) raw[i] = aRaw[i] ^ bRaw[i];
  vi dif(n + 1);
  dif[0] = raw[0];
  for (int i = int(0); i < int(n - 1); i++) dif[i + 1] = raw[i] ^ raw[i + 1];
  dif[n] = raw[n - 1];
  vector<vi> arr(k);
  vector<Rng> rngs(k);
  vi prevCost(k);
  ll curSum = 0;
  for (int i = int(0); i < int(k); i++) {
    for (int j = i; j <= n; j += k) arr[i].push_back(dif[j]);
    rngs[i].Init(arr[i]);
    prevCost[i] = rngs[i].GetCost();
    curSum += prevCost[i];
    cerrDummy << arr[i] << endl;
    cerrDummy << prevCost[i] << endl;
  }
  const auto Change = [&](int i, int v) {
    int p = i % k, q = i / k;
    curSum -= prevCost[p];
    rngs[p].Change(q, v);
    curSum += (prevCost[p] = rngs[p].GetCost());
  };
  const auto PrintAns = [&]() {
    if (curSum > n)
      print(-1);
    else
      print(curSum);
  };
  PrintAns();
  for (int _ = int(0); _ < int(qs); _++) {
    string dummy = readString();
    int p = read() - 1, v = read();
    if (dummy == "a") {
      v ^= aRaw[p];
      aRaw[p] ^= v;
    } else {
      v ^= bRaw[p];
      bRaw[p] ^= v;
    }
    Change(p, v);
    Change(p + 1, v);
    PrintAns();
  }
}