#include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int read() {
  int x = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * flag;
}
int n, m, q, l[M], r[M], u[M], d[M];
char s[M];
void get(int n, int *a) {
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) a[i] = (s[i] == 'R');
}
int cal() {
  int f0 = 0, f1 = 0, g0, g1;
  for (int i = 1; i <= m; i++) f0 += u[i], f1 += (!u[i]);
  for (int i = 1; i <= n; i++) {
    g0 = f0;
    g1 = f1;
    f0 = min(g0, g1 + m) + l[i] + r[i];
    f1 = min(g0 + m, g1) + (!l[i]) + (!r[i]);
  }
  for (int i = 1; i <= m; i++) f0 += d[i], f1 += (!d[i]);
  return min(f0, f1);
}
signed main() {
  n = read();
  m = read();
  q = read();
  get(n, l);
  get(n, r);
  get(m, u);
  get(m, d);
  int ans = cal();
  swap(n, m);
  swap(l, u);
  swap(r, d);
  ans = min(ans, cal());
  printf("%d\n", ans);
}
