#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, a[N], b[N], c[N], d[N], ans, f[N][2];
char s[N];
void sol(int n, int m) {
  f[0][0] = f[0][1] = 0;
  for (int i = (1); i <= (m); ++i) f[0][0] += c[i], f[0][1] += !c[i];
  for (int i = (1); i <= (n); ++i)
    f[i][0] = min(f[i - 1][0], f[i - 1][1] + m) + a[i] + b[i],
    f[i][1] = min(f[i - 1][1], f[i - 1][0] + m) + !a[i] + !b[i];
  f[n + 1][0] = f[n][0];
  f[n + 1][1] = f[n][1];
  for (int i = (1); i <= (m); ++i) f[n + 1][0] += d[i], f[n + 1][1] += !d[i];
  ans = min(ans, min(f[n + 1][0], f[n + 1][1]));
}
int main() {
  scanf("%d%d%*d", &n, &m);
  ans = n + n + m + m;
  scanf("%s", s + 1);
  for (int i = (1); i <= (n); ++i) a[i] = s[i] == 'R';
  scanf("%s", s + 1);
  for (int i = (1); i <= (n); ++i) b[i] = s[i] == 'R';
  scanf("%s", s + 1);
  for (int i = (1); i <= (m); ++i) c[i] = s[i] == 'R';
  scanf("%s", s + 1);
  for (int i = (1); i <= (m); ++i) d[i] = s[i] == 'R';
  sol(n, m);
  swap(a, c);
  swap(b, d);
  sol(m, n);
  printf("%d\n", ans);
  return 0;
}
