#include <bits/stdc++.h>
const int MAXN = 1e5;
int n, m, f[MAXN + 5][2];
char col[2][MAXN + 5], row[2][MAXN + 5];
inline int min_(const int a, const int b) { return a < b ? a : b; }
inline int solve(const int wid, const int hei, const char lr[2][MAXN + 5],
                 const char ud[2][MAXN + 5]) {
  int redL = 0, redR = 0;
  for (int i = 1; i <= hei; ++i) {
    if (lr[0][i] == 'R') ++redL;
    if (lr[1][i] == 'R') ++redR;
  }
  f[0][0] = hei - redL, f[0][1] = redL;
  for (int i = 1; i <= wid; ++i) {
    f[i][0] = (ud[0][i] == 'B') + (ud[1][i] == 'B') +
              min_(f[i - 1][0], f[i - 1][1] + hei);
    f[i][1] = (ud[0][i] == 'R') + (ud[1][i] == 'R') +
              min_(f[i - 1][1], f[i - 1][0] + hei);
  }
  return min_(f[wid][0] + hei - redR, f[wid][1] + redR);
}
int main() {
  scanf("%d %d %*d", &n, &m);
  scanf("%s %s", col[0] + 1, col[1] + 1);
  scanf("%s %s", row[0] + 1, row[1] + 1);
  printf("%d\n", min_(solve(m, n, col, row), solve(n, m, row, col)));
  return 0;
}
