#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int dp[2];
int get(char *lef, char *rig, char *up, char *down, int n, int m) {
  dp[0] = dp[1] = 0;
  for (int i = 1, iE = m; i <= iE; i++)
    dp[0] += (up[i] == 'R'), dp[1] += (up[i] == 'B');
  for (int i = 1, iE = n; i <= iE; i++) {
    dp[0] += (lef[i] == 'R') + (rig[i] == 'R');
    dp[1] += (lef[i] == 'B') + (rig[i] == 'B');
    dp[0] = min(dp[0], dp[1] + m), dp[1] = min(dp[1], dp[0] + m);
  }
  for (int i = 1, iE = m; i <= iE; i++)
    dp[0] += (down[i] == 'R'), dp[1] += (down[i] == 'B');
  return min(dp[0], dp[1]);
}
char lef[N], rig[N], up[N], down[N];
int now, len;
int n, m, q;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  scanf("%s%s%s%s", lef + 1, rig + 1, up + 1, down + 1);
  printf("%d\n",
         min(get(lef, rig, up, down, n, m), get(up, down, lef, rig, m, n)));
  return 0;
}
