#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
class Matrix {
 public:
  int a[2][2];
  Matrix(const int &x = 0) {
    for (int i = (0); i < (2); ++i)
      for (int j = (0); j < (2); ++j) a[i][j] = x;
    return;
  }
  inline int *operator[](const int &x) { return a[x]; }
  inline const int *operator[](const int &x) const { return a[x]; }
  inline Matrix operator*(const Matrix &oth) {
    Matrix R(INF);
    for (int i = (0); i < (2); ++i)
      for (int j = (0); j < (2); ++j)
        for (int k = (0); k < (2); ++k)
          R[i][j] = min(R[i][j], a[i][k] + oth[k][j]);
    return R;
  }
  inline void print() {
    for (int i = (0); i < (2); ++i) {
      for (int j = (0); j < (2); ++j) printf("%d ", a[i][j]);
      puts("");
    }
  }
} A[2][2], B[2][2];
inline Matrix I() {
  Matrix R(INF);
  R[0][0] = R[1][1] = 0;
  return R;
}
class SegmentTree {
 public:
  static const int siz = 131072;
  int n;
  int tag[siz << 1][2], sum[siz << 1][2][2];
  Matrix dat[siz << 1][2][2];
  inline void build(int n, char *s1, char *s2, Matrix A[2][2]) {
    for (int i = (siz); i < (siz << 1); ++i) {
      for (int x = (0); x < (2); ++x)
        for (int y = (0); y < (2); ++y) {
          if (i - siz < n) {
            dat[i][x][y] =
                A[(s1[i - siz] == 'R') ^ x][(s2[i - siz] == 'R') ^ y];
            sum[i][0][1] = (s1[i - siz] == 'R');
            sum[i][0][0] = (s1[i - siz] == 'B');
            sum[i][1][1] = (s2[i - siz] == 'R');
            sum[i][1][0] = (s2[i - siz] == 'B');
          } else
            dat[i][x][y] = I();
        }
    }
    for (int i = siz - 1; i; --i) {
      pushUp(i);
    }
    return;
  }
  inline void pushUp(int u) {
    for (int x = (0); x < (2); ++x)
      for (int y = (0); y < (2); ++y) {
        dat[u][x][y] = dat[u << 1][x][y] * dat[u << 1 | 1][x][y];
        sum[u][x][y] = sum[u << 1][x][y] + sum[u << 1 | 1][x][y];
      }
    return;
  }
  inline void apply(int u, int k) {
    for (int x = (0); x < (2); ++x) {
      if (!k)
        swap(dat[u][0][x], dat[u][1][x]);
      else
        swap(dat[u][x][0], dat[u][x][1]);
    }
    swap(sum[u][k][0], sum[u][k][1]);
    return;
  }
  inline void pushDown(int u) {
    for (int k = (0); k < (2); ++k) {
      if (tag[u][k]) {
        tag[u << 1][k] ^= 1, tag[u << 1 | 1][k] ^= 1;
        apply(u << 1, k);
        apply(u << 1 | 1, k);
        tag[u][k] = 0;
      }
    }
    return;
  }
  inline void update(int s, int t, int k, int u = 1, int l = 0,
                     int r = siz - 1) {
    if (l >= s && r <= t) {
      apply(u, k);
      tag[u][k] ^= 1;
      return;
    }
    int md = l + r >> 1;
    pushDown(u);
    if (s <= md) update(s, t, k, u << 1, l, md);
    if (t > md) update(s, t, k, u << 1 | 1, md + 1, r);
    pushUp(u);
    return;
  }
  inline Matrix query() { return dat[1][0][0]; }
  inline int query(int x, int y) { return sum[1][x][y]; }
} S, T;
int n, m;
inline void precalc() {
  for (int i = (0); i < (2); ++i)
    for (int j = (0); j < (2); ++j) {
      for (int x = (0); x < (2); ++x)
        for (int y = (0); y < (2); ++y) {
          A[i][j][x][y] = (x != y) * n + (y != i) + (y != j);
          B[i][j][x][y] = (x != y) * m + (y != i) + (y != j);
        }
    }
  return;
}
inline int calc() {
  Matrix F;
  F = S.query();
  int ans = 0x3f3f3f3f;
  for (int x = (0); x < (2); ++x)
    for (int y = (0); y < (2); ++y) {
      int res = F[x][y] + T.query(0, x ^ 1) + T.query(1, y ^ 1);
      ans = min(ans, res);
    }
  Matrix G;
  G = T.query();
  for (int x = (0); x < (2); ++x)
    for (int y = (0); y < (2); ++y) {
      int res = G[x][y] + S.query(0, x ^ 1) + S.query(1, y ^ 1);
      ans = min(ans, res);
    }
  return ans;
}
int q;
char L[maxn], R[maxn], U[maxn], D[maxn];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  precalc();
  scanf("%s", L);
  scanf("%s", R);
  scanf("%s", U);
  scanf("%s", D);
  S.build(n, L, R, B);
  T.build(m, U, D, A);
  printf("%d\n", calc());
  for (int i = (0); i < (q); ++i) {
    char buf[5];
    int l, r;
    scanf("%s%d%d", buf, &l, &r);
    --l;
    --r;
    if (buf[0] == 'L')
      S.update(l, r, 0);
    else if (buf[0] == 'R')
      S.update(l, r, 1);
    else if (buf[0] == 'U')
      T.update(l, r, 0);
    else
      T.update(l, r, 1);
    printf("%d\n", calc());
  }
  return 0;
}
