#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 998244353;
const ll root = 62;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = atan(1);
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 100001;
int n, m, q;
string l, r, u, d;
int dp[mxN][3];
int main() {
  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n >> m >> q;
  cin >> l >> r >> u >> d;
  int ans = INF;
  auto solve = [&] {
    memset(dp, INF, sizeof(dp));
    int cnt = 0;
    for (auto i = (0); i < (n); ++i) {
      cnt += (l[i] == 'B');
    }
    dp[0][0] = n;
    dp[0][1] = cnt;
    dp[0][2] = n - cnt;
    for (auto i = (1); i < (m + 1); ++i) {
      if (u[i - 1] == 'B' && d[i - 1] == 'B') {
        dp[i][0] = min(
            {dp[i - 1][2] + n, dp[i - 1][1] + 2 + n, dp[i - 1][0] + min(2, n)});
        dp[i][1] = dp[i - 1][1] + 2;
        dp[i][2] = min(dp[i - 1][0], dp[i - 1][2]);
      } else if (u[i - 1] == 'R' && d[i - 1] == 'R') {
        dp[i][0] = min(
            {dp[i - 1][1] + n, dp[i - 1][2] + 2 + n, dp[i - 1][0] + min(2, n)});
        dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]);
        dp[i][2] = dp[i - 1][2] + 2;
      } else {
        dp[i][0] = min({dp[i - 1][2] + 1 + n, dp[i - 1][1] + 1 + n,
                        dp[i - 1][0] + min(2, n)});
        dp[i][1] = min(dp[i - 1][0] + 1, dp[i - 1][1] + 1);
        dp[i][2] = min(dp[i - 1][0] + 1, dp[i - 1][2] + 1);
      }
    }
    cnt = 0;
    for (auto i = (0); i < (n); ++i) {
      cnt += (r[i] == 'B');
    }
    ans = min({ans, dp[m][0], dp[m][1] + cnt, dp[m][2] + n - cnt});
  };
  solve();
  swap(n, m);
  swap(l, u);
  swap(r, d);
  swap(l, r);
  reverse(u.begin(), u.end());
  reverse(d.begin(), d.end());
  solve();
  cout << ans << "\n";
  return 0;
}
