#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target("avx2")
using namespace std;
template <typename T>
void maxtt(T &t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T &t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
const long long MOD2 = (long long)1000000007 * (long long)1000000007;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
char L[(100035)], D[(100035)], R[(100035)], U[(100035)];
long long ans = (1LL << 60);
void cal(char *l, char *r, char *u, char *d, int n, int m) {
  vector<vector<long long>> dp(m + 5, vector<long long>(2, (1LL << 60)));
  int c0 = 0, c1 = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++)
    if (l[i] == 'R')
      c0++;
    else
      c1++;
  auto cal = [&](int col, int num) {
    int z = 0;
    if (u[col] == 'R' && num == 1) z++;
    if (d[col] == 'R' && num == 1) z++;
    if (u[col] == 'B' && num == 0) z++;
    if (d[col] == 'B' && num == 0) z++;
    return z;
  };
  dp[1][0] = c1 + cal(1, 0);
  dp[1][1] = c0 + cal(1, 1);
  for (int i = 2; i <= m; i++) {
    for (int(j) = 0; (j) < (int)(2); (j)++) {
      for (int(c) = 0; (c) < (int)(2); (c)++) {
        mintt(dp[i][c], dp[i - 1][j] + (j == c ? 0 : n) + cal(i, c));
      }
    }
  }
  c0 = 0;
  c1 = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++)
    if (r[i] == 'R')
      c0++;
    else
      c1++;
  mintt(ans, min(dp[m][0] + c1, dp[m][1] + c0));
}
void fmain(int tid) {
  int q;
  scanf("%d%d%d", &n, &m, &q);
  scanf("%s%s%s%s", L + 1, R + 1, U + 1, D + 1);
  cal(L, R, U, D, n, m);
  cal(U, D, R, L, m, n);
  printf("%lld\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
