#include <bits/stdc++.h>
const int MAXN = 1e5 + 5;
char L[MAXN], R[MAXN], U[MAXN], D[MAXN];
int n, m, q;
int f[MAXN][2];
inline int solve() {
  int cnt0 = 0;
  for (int i = 1; i <= n; ++i) cnt0 += (L[i] == 'B');
  int cnt1 = n - cnt0;
  memset(f, 0, sizeof(f));
  f[0][0] = cnt1;
  f[0][1] = cnt0;
  for (int i = 1; i <= m; ++i) {
    cnt0 = (U[i] == 'B') + (D[i] == 'B');
    cnt1 = 2 - cnt0;
    f[i][0] = std::min(f[i - 1][0], f[i - 1][1] + n) + cnt1;
    f[i][1] = std::min(f[i - 1][0] + n, f[i - 1][1]) + cnt0;
  }
  cnt0 = 0;
  for (int i = 1; i <= n; ++i) cnt0 += (R[i] == 'B');
  cnt1 = n - cnt0;
  return std::min(f[m][0] + cnt1, f[m][1] + cnt0);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  scanf("%s%s%s%s", L + 1, R + 1, U + 1, D + 1);
  int ans = solve();
  std::swap(n, m);
  std::swap(L, U);
  std::swap(R, D);
  ans = std::min(ans, solve());
  printf("%d\n", ans);
  return 0;
}
