#include <bits/stdc++.h>
using namespace std;
const int N = 101000;
int n, m, q, l[N], r[N], u[N], d[N];
char s[N];
int solve() {
  int f0 = 0, f1 = 0;
  for (int i = 1; i <= m; ++i) f0 += u[i], f1 += (!u[i]);
  for (int i = 1; i <= n; ++i) {
    int g0 = min(f0, f1 + m), g1 = min(f0 + m, f1);
    f0 = g0 + l[i] + r[i];
    f1 = g1 + (!l[i]) + (!r[i]);
  }
  for (int i = 1; i <= m; ++i) f0 += d[i], f1 += (!d[i]);
  return min(f0, f1);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    l[i] = s[i] == 'R';
  }
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    r[i] = s[i] == 'R';
  }
  scanf("%s", s + 1);
  for (int i = 1; i <= m; ++i) {
    u[i] = s[i] == 'R';
  }
  scanf("%s", s + 1);
  for (int i = 1; i <= m; ++i) {
    d[i] = s[i] == 'R';
  }
  int ans1 = solve(), ans2;
  swap(n, m);
  swap(l, u);
  swap(r, d);
  ans2 = solve();
  printf("%d\n", min(ans1, ans2));
  return 0;
}
