#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
int n, m, q, i, j, dp[2], ans;
string s[2], t[2];
struct segtree {
  int n, m;
  int dis[800005][2][2][2][2], cnt[800005][2][2];
  bool rev[800005][2];
  void pushup(int x) {
    memset(dis[x], 0x3f, sizeof(dis[x]));
    int i, j, a, b, c, d;
    for (((i)) = (0); ((i)) <= ((2) - 1); ((i))++) {
      cnt[x][0][i] = cnt[x + x][0][i] + cnt[x + x + 1][0][i];
      cnt[x][1][i] = cnt[x + x][1][i] + cnt[x + x + 1][1][i];
      for (((j)) = (0); ((j)) <= ((2) - 1); ((j))++)
        for (((a)) = (0); ((a)) <= ((2) - 1); ((a))++)
          for (((b)) = (0); ((b)) <= ((2) - 1); ((b))++)
            for (((c)) = (0); ((c)) <= ((2) - 1); ((c))++)
              for (((d)) = (0); ((d)) <= ((2) - 1); ((d))++) {
                dis[x][i][j][a][d] =
                    min(dis[x][i][j][a][d], dis[x + x][i][j][a][b] +
                                                dis[x + x + 1][i][j][c][d] +
                                                (b != c) * n);
              }
    }
  }
  void upd(int x, int r0, int r1) {
    rev[x][0] ^= r0;
    rev[x][1] ^= r1;
    if (r0) {
      swap(cnt[x][0][0], cnt[x][0][1]);
      swap(dis[x][0], dis[x][1]);
    }
    if (r1) {
      swap(cnt[x][1][0], cnt[x][1][1]);
      swap(dis[x][0][0], dis[x][0][1]);
      swap(dis[x][1][0], dis[x][1][1]);
    }
  }
  void pushdo(int x) {
    if (rev[x][0] || rev[x][1]) {
      upd(x + x, rev[x][0], rev[x][1]);
      upd(x + x + 1, rev[x][0], rev[x][1]);
      rev[x][0] = rev[x][1] = 0;
    }
  }
  void build(int x, int l, int r, const string &s0, const string &s1) {
    if (l == r) {
      cnt[x][0][s0[l] == 'B'] = 1;
      cnt[x][1][s1[l] == 'B'] = 1;
      int i, j;
      for (((i)) = (0); ((i)) <= ((2) - 1); ((i))++)
        for (((j)) = (0); ((j)) <= ((2) - 1); ((j))++) {
          dis[x][i][j][0][1] = dis[x][i][j][1][0] = 0x3f3f3f3f;
          dis[x][i][j][0][0] = cnt[x][0][i ^ 1] + cnt[x][1][j ^ 1];
          dis[x][i][j][1][1] = cnt[x][0][i] + cnt[x][1][j];
        }
      return;
    }
    int mid = (l + r) / 2;
    build(x + x, l, mid, s0, s1);
    build(x + x + 1, mid + 1, r, s0, s1);
    pushup(x);
  }
  void update(int x, int l, int r, int ql, int qr, int op) {
    if (ql <= l && r <= qr) {
      upd(x, op == 0, op == 1);
      return;
    }
    pushdo(x);
    int mid = (l + r) / 2;
    if (ql <= mid) {
      update(x + x, l, mid, ql, qr, op);
    }
    if (qr > mid) {
      update(x + x + 1, mid + 1, r, ql, qr, op);
    }
    pushup(x);
  }
} trs, trt;
int calc() {
  int ans = 0x3f3f3f3f;
  int i, j;
  for (((i)) = (0); ((i)) <= ((2) - 1); ((i))++)
    for (((j)) = (0); ((j)) <= ((2) - 1); ((j))++) {
      ans = min(ans, trs.dis[1][0][0][i][j] + trt.cnt[1][0][i ^ 1] +
                         trt.cnt[1][1][j ^ 1]);
      ans = min(ans, trt.dis[1][0][0][i][j] + trs.cnt[1][0][i ^ 1] +
                         trs.cnt[1][1][j ^ 1]);
    }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n >> m >> q;
  cin >> s[0] >> s[1];
  s[0] = " " + s[0];
  s[1] = " " + s[1];
  cin >> t[0] >> t[1];
  t[0] = " " + t[0];
  t[1] = " " + t[1];
  trs.n = n;
  trs.m = m;
  trs.build(1, 1, m, t[0], t[1]);
  trt.n = m;
  trt.m = n;
  trt.build(1, 1, n, s[0], s[1]);
  cout << calc() << endl;
  while (q--) {
    char op;
    int x, y;
    cin >> op >> x >> y;
    if (op == 'U') {
      trs.update(1, 1, m, x, y, 0);
    }
    if (op == 'D') {
      trs.update(1, 1, m, x, y, 1);
    }
    if (op == 'L') {
      trt.update(1, 1, n, x, y, 0);
    }
    if (op == 'R') {
      trt.update(1, 1, n, x, y, 1);
    }
    cout << calc() << endl;
  }
  return 0;
}
