#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, q;
char cu[N], cd[N], cl[N], cr[N];
struct seg {
  int n, m, cnt[N << 2][2][2], cost[N << 2][2][2][2][2];
  bool rev[N << 2][2];
  void up(int x) {
    memset(cost[x], 0x3f, sizeof(cost[x]));
    for (int i = 0; i < 2; i++) {
      cnt[x][0][i] = cnt[(x << 1)][0][i] + cnt[(x << 1 | 1)][0][i];
      cnt[x][1][i] = cnt[(x << 1)][1][i] + cnt[(x << 1 | 1)][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++)
                cost[x][i][j][a][d] =
                    min(cost[x][i][j][a][d],
                        cost[(x << 1)][i][j][a][b] +
                            cost[(x << 1 | 1)][i][j][c][d] + n * (b != c));
    }
  }
  void mdf(int x, bool rev0, bool rev1) {
    if (rev0) {
      swap(cnt[x][0][0], cnt[x][0][1]);
      swap(cost[x][0], cost[x][1]);
      rev[x][0] ^= 1;
    }
    if (rev1) {
      swap(cnt[x][1][0], cnt[x][1][1]);
      swap(cost[x][0][0], cost[x][0][1]);
      swap(cost[x][1][0], cost[x][1][1]);
      rev[x][1] ^= 1;
    }
  }
  void down(int x) {
    if (rev[x][0] || rev[x][1]) {
      mdf((x << 1), rev[x][0], rev[x][1]);
      mdf((x << 1 | 1), rev[x][0], rev[x][1]);
      rev[x][0] = rev[x][1] = 0;
    }
  }
  void build(char *cu, char *cd, int x, int l, int r) {
    if (l == r) {
      cnt[x][0][cu[l] == 'B'] = 1;
      cnt[x][1][cd[l] == 'B'] = 1;
      for (int i = 0; i < 2; i++)
        for (int j = 0; j < 2; j++) {
          cost[x][i][j][0][1] = cost[x][i][j][1][0] = 1e9;
          cost[x][i][j][0][0] = cnt[x][0][i ^ 1] + cnt[x][1][j ^ 1];
          cost[x][i][j][1][1] = cnt[x][0][i] + cnt[x][1][j];
        }
      return;
    }
    int mid = (l + r) >> 1;
    build(cu, cd, (x << 1), l, mid);
    build(cu, cd, (x << 1 | 1), mid + 1, r);
    up(x);
  }
  void build(char *cu, char *cd) { build(cu, cd, 1, 1, m); }
  void modify(int L, int R, int op, int x, int l, int r) {
    if (L <= l && r <= R) return mdf(x, op == 0, op == 1);
    down(x);
    int mid = (l + r) >> 1;
    if (L <= mid) modify(L, R, op, (x << 1), l, mid);
    if (R > mid) modify(L, R, op, (x << 1 | 1), mid + 1, r);
    up(x);
  }
  void modify(int L, int R, int op) { modify(L, R, op, 1, 1, m); }
} UD, LR;
int cal() {
  int ret = 1e9;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      ret = min(ret, UD.cost[1][0][0][i][j] + LR.cnt[1][0][i ^ 1] +
                         LR.cnt[1][1][j ^ 1]);
      ret = min(ret, LR.cost[1][0][0][i][j] + UD.cnt[1][0][i ^ 1] +
                         UD.cnt[1][1][j ^ 1]);
    }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  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 << cal() << '\n';
  while (q--) {
    char op;
    int l, r;
    cin >> op >> l >> r;
    if (op == 'U' || op == 'D')
      UD.modify(l, r, op == 'D');
    else
      LR.modify(l, r, op == 'R');
    cout << cal() << '\n';
  }
  return 0;
}
