#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, q, f1[2][N], f2[2][N];
char s1[N], s2[N], s3[N], s4[N];
int main() {
  scanf("%d%d%d\n%s\n%s\n%s\n%s", &n, &m, &q, s1 + 1, s2 + 1, s3 + 1, s4 + 1);
  for (int i = 1; i <= n; i++)
    f1[0][0] += (s1[i] == 'R'), f1[1][0] += (s1[i] == 'B');
  for (int i = 1; i <= m; i++)
    f1[0][i] =
        min(f1[0][i - 1], f1[1][i - 1] + n) + (s3[i] == 'R') + (s4[i] == 'R'),
    f1[1][i] =
        min(f1[1][i - 1], f1[0][i - 1] + n) + (s3[i] == 'B') + (s4[i] == 'B');
  for (int i = 1; i <= n; i++)
    f1[0][m] += (s2[i] == 'R'), f1[1][m] += (s2[i] == 'B');
  for (int i = 1; i <= m; i++)
    f2[0][0] += (s3[i] == 'R'), f2[1][0] += (s3[i] == 'B');
  for (int i = 1; i <= n; i++)
    f2[0][i] =
        min(f2[0][i - 1], f2[1][i - 1] + m) + (s1[i] == 'R') + (s2[i] == 'R'),
    f2[1][i] =
        min(f2[1][i - 1], f2[0][i - 1] + m) + (s1[i] == 'B') + (s2[i] == 'B');
  for (int i = 1; i <= m; i++)
    f2[0][n] += (s4[i] == 'R'), f2[1][n] += (s4[i] == 'B');
  printf("%d\n", min(min(f1[0][m], f1[1][m]), min(f2[0][n], f2[1][n])));
  return 0;
}
