#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && (c != '-')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const int N = 1e5 + 10;
int n, m, q;
char L[N], R[N], U[N], D[N];
int f[N][2];
inline int solve(int n, int m, char *L, char *R, char *U, char *D) {
  f[1][0] = (L[1] != 'R') + (R[1] != 'R');
  f[1][1] = (L[1] != 'B') + (R[1] != 'B');
  for (register int i = (1); i <= (m); i++)
    f[1][0] += (U[i] != 'R'), f[1][1] += (U[i] != 'B');
  for (register int i = (2); i <= (n); i++) {
    f[i][0] = min(f[i - 1][0], f[i - 1][1] + m) + (L[i] != 'R') + (R[i] != 'R');
    f[i][1] = min(f[i - 1][1], f[i - 1][0] + m) + (L[i] != 'B') + (R[i] != 'B');
  }
  for (register int i = (1); i <= (m); i++)
    f[n][0] += (D[i] != 'R'), f[n][1] += (D[i] != 'B');
  return min(f[n][0], f[n][1]);
}
int main() {
  n = read(), m = read(), q = read();
  scanf("%s%s%s%s", L + 1, R + 1, U + 1, D + 1);
  printf("%d\n", min(solve(n, m, L, R, U, D), solve(m, n, U, D, L, R)));
}
