#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
const long long mod = 998244353;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
int test = 1;
int push_back[N], pr[N], n, m, q, dp[N][2];
char L[N], R[N], U[N], D[N];
int solve(char *L, char *R, char *U, char *D, int n, int m, char r, char b) {
  dp[0][0] = dp[0][1] = 0;
  for (int i = 0; i < n; i++) {
    dp[0][0] += (L[i] == b);
    dp[0][1] += (L[i] == r);
  }
  dp[0][0] += (U[0] == b) + (D[0] == b);
  dp[0][1] += (U[0] == r) + (D[0] == r);
  for (int i = 1; i < m; i++) {
    dp[i][0] = min(dp[i - 1][0], dp[i - 1][1] + n) + (U[i] == b) + (D[i] == b);
    dp[i][1] = min(dp[i - 1][1], dp[i - 1][0] + n) + (U[i] == r) + (D[i] == r);
  }
  for (int i = 0; i < n; i++) {
    dp[m - 1][0] += (R[i] == b);
    dp[m - 1][1] += (R[i] == r);
  }
  return min(dp[m - 1][0], dp[m - 1][1]);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(15);
  ;
  cin >> n >> m >> q;
  cin >> L >> R >> U >> D;
  int pR = 0;
  for (int i = 0; i < n; i++) pR += (L[i] == 'R') + (R[i] == 'R');
  for (int i = 0; i < m; i++) pR += (U[i] == 'R') + (D[i] == 'R');
  int ans = min(pR, 2 * (n + m) - pR);
  ans = min(ans, solve(L, R, U, D, n, m, 'R', 'B'));
  ans = min(ans, solve(U, D, L, R, m, n, 'R', 'B'));
  cout << ans << "\n";
}
