#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int INF = 0x3f3f3f3f;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
template <typename T>
inline void cmin(T &x, T y) {
  if (y < x) x = y;
}
struct Node {
  int dp[2][2][2];
};
inline Node Merge(Node a, Node b, int x) {
  Node c;
  for (int k = 0; k < 2; ++k) {
    for (int l = 0; l < 2; ++l) {
      for (int r = 0; r < 2; ++r) {
        int tmp = INF;
        cmin(tmp, a.dp[k][l][0] + b.dp[k][0][r]);
        cmin(tmp, a.dp[k][l][1] + b.dp[k][1][r]);
        cmin(tmp, a.dp[k][l][0] + b.dp[k][1][r] + x);
        cmin(tmp, a.dp[k][l][1] + b.dp[k][0][r] + x);
        c.dp[k][l][r] = tmp;
      }
    }
  }
  return c;
}
struct SegmentTree {
  Node seg[MAXN << 2];
  int n, m, len[MAXN << 2], cnt1[MAXN << 2], cnt2[MAXN << 2];
  bool tag1[MAXN << 2], tag2[MAXN << 2];
  inline void puttag(int rt, int tg1, int tg2) {
    if (tg1) {
      cnt1[rt] = len[rt] - cnt1[rt];
      for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
          swap(seg[rt].dp[0][i][j], seg[rt].dp[1][i ^ 1][j ^ 1]);
        }
      }
      tag1[rt] ^= 1;
    }
    if (tg2) {
      cnt2[rt] = len[rt] - cnt2[rt];
      for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
          swap(seg[rt].dp[0][i][j], seg[rt].dp[1][i][j]);
        }
      }
      tag2[rt] ^= 1;
    }
  }
  inline void pushdown(int rt) {
    if (!tag1[rt] && !tag2[rt]) return;
    puttag((rt << 1), tag1[rt], tag2[rt]);
    puttag((rt << 1) | 1, tag1[rt], tag2[rt]);
    tag1[rt] = tag2[rt] = 0;
  }
  inline void pushup(int rt) {
    cnt1[rt] = cnt1[(rt << 1)] + cnt1[(rt << 1) | 1];
    cnt2[rt] = cnt2[(rt << 1)] + cnt2[(rt << 1) | 1];
    seg[rt] = Merge(seg[(rt << 1)], seg[(rt << 1) | 1], m);
  }
  void Build(int rt, int b, int e, char *CL, char *CR) {
    len[rt] = e - b + 1;
    if (b == e) {
      int cl = (CL[b] == 'B'), cr = (CR[b] == 'B');
      cnt1[rt] = cl;
      cnt2[rt] = cr;
      for (int k = 0; k < 2; ++k) {
        for (int i = 0; i < 2; ++i) {
          seg[rt].dp[k][i][i] = (i != cl) + ((i ^ k) != cr);
          seg[rt].dp[k][i][i ^ 1] = INF;
        }
      }
      return;
    }
    int mid = (b + e) >> 1;
    Build((rt << 1), b, mid, CL, CR);
    Build((rt << 1) | 1, mid + 1, e, CL, CR);
    pushup(rt);
  }
  void Update(int rt, int b, int e, int l, int r, int v1, int v2) {
    if (l <= b && e <= r) {
      puttag(rt, v1, v2);
      return;
    }
    int mid = (b + e) >> 1;
    pushdown(rt);
    if (l <= mid) Update((rt << 1), b, mid, l, r, v1, v2);
    if (r > mid) Update((rt << 1) | 1, mid + 1, e, l, r, v1, v2);
    pushup(rt);
  }
} T1, T2;
inline int GetAns() {
  int ret = INF;
  Node a1 = T1.seg[1], a2 = T2.seg[1];
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      int cur1 = a1.dp[0][i][j];
      cur1 += (i ? T2.n - T2.cnt1[1] : T2.cnt1[1]);
      cur1 += (j ? T2.n - T2.cnt2[1] : T2.cnt2[1]);
      cmin(ret, cur1);
      int cur2 = a2.dp[0][i][j];
      cur2 += (i ? T1.n - T1.cnt1[1] : T1.cnt1[1]);
      cur2 += (j ? T1.n - T1.cnt2[1] : T1.cnt2[1]);
      cmin(ret, cur2);
    }
  }
  return ret;
}
char L[MAXN], R[MAXN], U[MAXN], D[MAXN];
int n, m, q;
void init() {
  read(n);
  read(m);
  read(q);
  scanf("%s", L + 1);
  scanf("%s", R + 1);
  scanf("%s", U + 1);
  scanf("%s", D + 1);
  T1.n = n;
  T1.m = m;
  T1.Build(1, 1, T1.n, L, R);
  T2.n = m;
  T2.m = n;
  T2.Build(1, 1, T2.n, U, D);
}
void solve() {
  printf("%d\n", GetAns());
  char op[10];
  int l, r;
  while (q--) {
    scanf("%s", op);
    read(l);
    read(r);
    if (op[0] == 'L') {
      T1.Update(1, 1, T1.n, l, r, 1, 0);
    } else if (op[0] == 'R') {
      T1.Update(1, 1, T1.n, l, r, 0, 1);
    } else if (op[0] == 'U') {
      T2.Update(1, 1, T2.n, l, r, 1, 0);
    } else if (op[0] == 'D') {
      T2.Update(1, 1, T2.n, l, r, 0, 1);
    }
    printf("%d\n", GetAns());
  }
}
int main() {
  init();
  solve();
  return 0;
}
