#include <bits/stdc++.h>
const int MAXN = 1e5 + 5;
struct DS {
  int f[4][MAXN << 2][2][2], rev[MAXN << 2];
  int a[MAXN][2], cnt[MAXN << 2][2], ext;
  DS() {
    memset(f, 0x3f, sizeof(f));
    memset(rev, 0, sizeof(rev));
    memset(a, 0, sizeof(a));
    memset(cnt, 0, sizeof(cnt));
    ext = 0;
  }
  inline void pushup(int x) {
    for (int a = 0; a <= 3; ++a) {
      memset(f[a][x], 0x3f, sizeof(f[a][x]));
      for (int i = 0; i <= 1; ++i) {
        for (int j = 0; j <= 1; ++j) {
          for (int k = 0; k <= 1; ++k) {
            for (int l = 0; l <= 1; ++l) {
              f[a][x][i][j] =
                  std::min(f[a][x][i][j], f[a][((x) << 1)][i][k] +
                                              f[a][((x) << 1 | 1)][l][j] +
                                              (k != l) * ext);
            }
          }
        }
      }
    }
    for (int i = 0; i <= 1; ++i)
      cnt[x][i] = cnt[((x) << 1)][i] + cnt[((x) << 1 | 1)][i];
  }
  inline void build(int x, int l, int r) {
    if (l == r) {
      for (int i = 0; i <= 3; ++i) {
        int cnt0 = (a[l][0] ^ (i & 1)) + (a[l][1] ^ ((i >> 1) & 1)),
            cnt1 = 2 - cnt0;
        f[i][x][0][0] = cnt1;
        f[i][x][1][1] = cnt0;
      }
      cnt[x][0] = a[l][0];
      cnt[x][1] = a[l][1];
      return;
    }
    int mid = (l + r) >> 1;
    build(((x) << 1), l, mid);
    build(((x) << 1 | 1), mid + 1, r);
    pushup(x);
  }
  inline void reverse(int x, int l, int r, int d) {
    rev[x] ^= d;
    if (d == 1) {
      std::swap(f[0][x], f[1][x]);
      std::swap(f[2][x], f[3][x]);
    }
    if (d == 2) {
      std::swap(f[0][x], f[2][x]);
      std::swap(f[1][x], f[3][x]);
    }
    if (d == 3) {
      std::swap(f[0][x], f[3][x]);
      std::swap(f[1][x], f[2][x]);
    }
    int len = r - l + 1;
    if (d & 1) cnt[x][0] = len - cnt[x][0];
    if (d & 2) cnt[x][1] = len - cnt[x][1];
  }
  inline void pushdown(int x, int l, int r) {
    if (rev[x]) {
      int mid = (l + r) >> 1;
      reverse(((x) << 1), l, mid, rev[x]);
      reverse(((x) << 1 | 1), mid + 1, r, rev[x]);
      rev[x] = 0;
    }
  }
  inline void modify(int x, int l, int r, int L, int R, int d) {
    if (l == L && r == R) {
      reverse(x, l, r, d);
      return;
    }
    int mid = (l + r) >> 1;
    pushdown(x, l, r);
    if (R <= mid)
      modify(((x) << 1), l, mid, L, R, d);
    else if (L > mid)
      modify(((x) << 1 | 1), mid + 1, r, L, R, d);
    else
      modify(((x) << 1), l, mid, L, mid, d),
          modify(((x) << 1 | 1), mid + 1, r, mid + 1, R, d);
    pushup(x);
  }
} LR, UD;
int n, m, q;
char U[MAXN], D[MAXN], L[MAXN], R[MAXN], opt[233];
inline int query() {
  int l[2], r[2], u[2], d[2];
  l[0] = LR.cnt[1][0];
  r[0] = LR.cnt[1][1];
  u[0] = UD.cnt[1][0];
  d[0] = UD.cnt[1][1];
  l[1] = n - l[0];
  r[1] = n - r[0];
  u[1] = m - u[0];
  d[1] = m - d[0];
  int ans = 1e9;
  for (int i = 0; i <= 1; ++i) {
    for (int j = 0; j <= 1; ++j) {
      ans = std::min(ans, LR.f[0][1][i][j] + u[i ^ 1] + d[j ^ 1]);
      ans = std::min(ans, UD.f[0][1][i][j] + l[i ^ 1] + r[j ^ 1]);
    }
  }
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  scanf("%s%s%s%s", L + 1, R + 1, U + 1, D + 1);
  LR.ext = m;
  UD.ext = n;
  for (int i = 1; i <= n; ++i)
    LR.a[i][0] = L[i] == 'B', LR.a[i][1] = R[i] == 'B';
  LR.build(1, 1, n);
  for (int i = 1; i <= m; ++i)
    UD.a[i][0] = U[i] == 'B', UD.a[i][1] = D[i] == 'B';
  UD.build(1, 1, m);
  printf("%d\n", query());
  for (int i = 1; i <= q; ++i) {
    int l, r;
    scanf("%s%d%d", opt, &l, &r);
    if (opt[0] == 'L') {
      LR.modify(1, 1, n, l, r, 1);
    }
    if (opt[0] == 'R') {
      LR.modify(1, 1, n, l, r, 2);
    }
    if (opt[0] == 'U') {
      UD.modify(1, 1, m, l, r, 1);
    }
    if (opt[0] == 'D') {
      UD.modify(1, 1, m, l, r, 2);
    }
    printf("%d\n", query());
  }
  return 0;
}
