#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 23;
const int N = 1 << 17;
int n, m, q;
bool col[4][MAXN];
bool get() {
  char c;
  cin >> c;
  return c == 'B';
}
int ans[MAXN];
pair<char, pair<int, int> > ope[MAXN];
map<char, char> Map;
struct SEGMENTTREE1 {
  int tree[N + N][2];
  bool tag[N + N];
  void build_tree(bool* a) {
    memset(tree, 0, sizeof(tree));
    memset(tag, 0, sizeof(tag));
    for (int i = 1; i <= m; ++i) {
      tree[N + i - 1][a[i]] = 1;
    }
    for (int i = N - 1; i >= 1; --i)
      tree[i][0] = tree[i << 1][0] + tree[i << 1 | 1][0],
      tree[i][1] = tree[i << 1][1] + tree[i << 1 | 1][1];
  }
  void pd(int now) {
    if (tag[now]) {
      tag[now] = 0;
      swap(tree[now][0], tree[now][1]);
      if (now < N) tag[now << 1] ^= 1, tag[now << 1 | 1] ^= 1;
    }
  }
  void pu(int now) {
    tree[now][0] = tree[now << 1][0] + tree[now << 1 | 1][0];
    tree[now][1] = tree[now << 1][1] + tree[now << 1 | 1][1];
  }
  void flip(int a, int b, int now = 1, int l = 1, int r = N + 1) {
    pd(now);
    if (r <= a || l >= b) return;
    if (r <= b && l >= a) {
      tag[now] ^= 1;
      return pd(now);
    }
    int mid = (l + r) >> 1;
    flip(a, b, now << 1, l, mid);
    flip(a, b, now << 1 | 1, mid, r);
    pu(now);
  }
} sgt1, sgt2;
struct Matrix {
  int a[2][2];
  Matrix() { memset(a, 63, sizeof(a)); }
  Matrix(int A, int B, int C, int D) {
    a[0][0] = A, a[0][1] = B, a[1][0] = C, a[1][1] = D;
  }
  Matrix operator*(const Matrix oth) {
    Matrix ret;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          ret.a[i][j] = min(ret.a[i][j], a[i][k] + oth.a[k][j]);
    return ret;
  }
};
Matrix I(0, INF, INF, 0);
struct Vec {
  int a[2];
  Vec() { memset(a, 63, sizeof(a)); }
  Vec(int A, int B) { a[0] = A, a[1] = B; }
  Vec operator*(const Matrix oth) {
    Vec ret;
    for (int j = 0; j < 2; ++j)
      for (int i = 0; i < 2; ++i) ret.a[j] = min(ret.a[j], a[i] + oth.a[i][j]);
    return ret;
  }
};
Matrix mat(int A, int B) {
  return Matrix(A + B, m + A + B, m + (!A) + (!B), (!A) + (!B));
}
struct SEGMENTTREE2 {
  Matrix tree[N + N][2][2];
  bool tag[N + N][2];
  void build_tree(bool* left, bool* right) {
    memset(tag, 0, sizeof(tag));
    for (int i = 0; i < N + N; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k) tree[i][j][k] = I;
    for (int i = 1; i <= n; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          tree[N - 1 + i][j][k] = mat(j ^ left[i], k ^ right[i]);
    for (int i = N - 1; i >= 1; --i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 2; ++k)
          tree[i][j][k] = tree[i << 1][j][k] * tree[i << 1 | 1][j][k];
  }
  void pd(int now) {
    if (tag[now][1]) {
      tag[now][1] = 0;
      swap(tree[now][0][0], tree[now][0][1]);
      swap(tree[now][1][0], tree[now][1][1]);
      if (now < N) tag[now << 1][1] ^= 1, tag[now << 1 | 1][1] ^= 1;
    }
    if (tag[now][0]) {
      tag[now][0] = 0;
      swap(tree[now][1][0], tree[now][0][0]);
      swap(tree[now][1][1], tree[now][0][1]);
      if (now < N) tag[now << 1][0] ^= 1, tag[now << 1 | 1][0] ^= 1;
    }
  }
  void pu(int now) {
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < 2; ++j)
        tree[now][i][j] = tree[now << 1][i][j] * tree[now << 1 | 1][i][j];
  }
  void flip(int a, int b, bool num, int now = 1, int l = 1, int r = N + 1) {
    pd(now);
    if (r <= a || l >= b) return;
    if (r <= b && l >= a) {
      tag[now][num] ^= 1;
      return pd(now);
    }
    int mid = (l + r) >> 1;
    flip(a, b, num, now << 1, l, mid);
    flip(a, b, num, now << 1 | 1, mid, r);
    pu(now);
  }
} sgt3;
void solve() {
  sgt1.build_tree(col[2]);
  sgt2.build_tree(col[3]);
  sgt3.build_tree(col[0], col[1]);
  for (int i = 0; i <= q; ++i) {
    if (i) {
      if (ope[i].first == 'U') {
        sgt1.flip(ope[i].second.first, ope[i].second.second + 1);
      }
      if (ope[i].first == 'D') {
        sgt2.flip(ope[i].second.first, ope[i].second.second + 1);
      }
      if (ope[i].first == 'L') {
        sgt3.flip(ope[i].second.first, ope[i].second.second + 1, 0);
      }
      if (ope[i].first == 'R') {
        sgt3.flip(ope[i].second.first, ope[i].second.second + 1, 1);
      }
    }
    Vec rest(sgt1.tree[1][1], sgt1.tree[1][0]);
    rest = rest * sgt3.tree[1][0][0];
    rest.a[0] += sgt2.tree[1][1];
    rest.a[1] += sgt2.tree[1][0];
    ans[i] = min(ans[i], min(rest.a[0], rest.a[1]));
  }
}
int main() {
  Map['U'] = 'L';
  Map['L'] = 'U';
  Map['D'] = 'R';
  Map['R'] = 'D';
  scanf("%d%d%d", &n, &m, &q);
  for (int j = 0; j < 2; ++j)
    for (int i = 1; i <= n; ++i) col[j][i] = get();
  for (int j = 2; j <= 3; ++j)
    for (int i = 1; i <= m; ++i) col[j][i] = get();
  memset(ans, 63, sizeof(ans));
  for (int i = 1; i <= q; ++i) {
    cin >> ope[i].first;
    scanf("%d%d", &ope[i].second.first, &ope[i].second.second);
  }
  solve();
  swap(n, m);
  for (int i = 1; i <= q; ++i) {
    ope[i].first = Map[ope[i].first];
  }
  swap(col[0], col[2]);
  swap(col[1], col[3]);
  solve();
  for (int i = 0; i <= q; ++i) printf("%d\n", ans[i]);
  return 0;
}
