#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, q;
char cu[N], cd[N], cl[N], cr[N];
inline int lc(int x) { return x << 1; }
inline int rc(int x) { return x << 1 | 1; }
struct SegmentTree {
  int n, m;
  struct TNode {
    int c[2][2], v[2][2][2][2], l, r;
  } t[N << 2];
  bool rev[N << 2][2];
  void pushup(int pos) {
    memset(t[pos].v, 63, sizeof(t[pos].v));
    for (int i = 0; i < 2; i++) {
      t[pos].c[0][i] = t[lc(pos)].c[0][i] + t[rc(pos)].c[0][i];
      t[pos].c[1][i] = t[lc(pos)].c[1][i] + t[rc(pos)].c[1][i];
      for (int j = 0; j < 2; j++)
        for (int a = 0; a < 2; a++)
          for (int b = 0; b < 2; b++)
            for (int c = 0; c < 2; c++)
              for (int d = 0; d < 2; d++)
                t[pos].v[i][j][a][d] =
                    min(t[pos].v[i][j][a][d], t[lc(pos)].v[i][j][a][b] +
                                                  t[rc(pos)].v[i][j][c][d] +
                                                  n * (b != c));
    }
  }
  void push(int pos, bool r0, bool r1) {
    if (r0) {
      swap(t[pos].c[0][0], t[pos].c[0][1]);
      swap(t[pos].v[0], t[pos].v[1]);
      rev[pos][0] ^= 1;
    }
    if (r1) {
      swap(t[pos].c[1][0], t[pos].c[1][1]);
      swap(t[pos].v[0][0], t[pos].v[0][1]);
      swap(t[pos].v[1][0], t[pos].v[1][1]);
      rev[pos][1] ^= 1;
    }
  }
  void pushdown(int pos) {
    if (rev[pos][0] || rev[pos][1]) {
      push(lc(pos), rev[pos][0], rev[pos][1]);
      push(rc(pos), rev[pos][0], rev[pos][1]);
      rev[pos][0] = rev[pos][1] = 0;
    }
  }
  void build(int pos, int l, int r, char cu[], char cd[]) {
    t[pos].l = l;
    t[pos].r = r;
    if (l == r) {
      t[pos].c[0][cu[l] == 'B'] = 1;
      t[pos].c[1][cd[l] == 'B'] = 1;
      for (int i = 0; i < 2; i++)
        for (int j = 0; j < 2; j++) {
          t[pos].v[i][j][0][1] = INT_MAX >> 2;
          t[pos].v[i][j][1][0] = INT_MAX >> 2;
          t[pos].v[i][j][0][0] = t[pos].c[0][i ^ 1] + t[pos].c[1][j ^ 1];
          t[pos].v[i][j][1][1] = t[pos].c[0][i] + t[pos].c[1][j];
        }
      return;
    }
    int mid = (l + r) >> 1;
    build(lc(pos), l, mid, cu, cd);
    build(rc(pos), mid + 1, r, cu, cd);
    pushup(pos);
  }
  inline void build(char cu[], char cd[]) { build(1, 1, m, cu, cd); }
  void modify(int pos, int l, int r, int v) {
    if (t[pos].l == l && t[pos].r == r) return push(pos, v == 0, v == 1);
    pushdown(pos);
    int mid = (t[pos].l + t[pos].r) >> 1;
    if (r <= mid)
      modify(lc(pos), l, r, v);
    else if (l > mid)
      modify(rc(pos), l, r, v);
    else
      modify(lc(pos), l, mid, v), modify(rc(pos), mid + 1, r, v);
    pushup(pos);
  }
} ud, lr;
int calc() {
  int ret = INT_MAX;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      ret = min(ret, ud.t[1].v[0][0][i][j] + lr.t[1].c[0][i ^ 1] +
                         lr.t[1].c[1][j ^ 1]),
      ret = min(ret, lr.t[1].v[0][0][i][j] + ud.t[1].c[0][i ^ 1] +
                         ud.t[1].c[1][j ^ 1]);
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q >> (cl + 1) >> (cr + 1) >> (cu + 1) >> (cd + 1);
  ud.n = n;
  ud.m = m;
  lr.n = m;
  lr.m = n;
  ud.build(cu, cd);
  lr.build(cl, cr);
  cout << calc() << endl;
  while (q--) {
    char op;
    int l, r;
    cin >> op >> l >> r;
    if (op == 'U' || op == 'D')
      ud.modify(1, l, r, op == 'D');
    else
      lr.modify(1, l, r, op == 'R');
    cout << calc() << endl;
  }
  return 0;
}
