#include <bits/stdc++.h>
using namespace std;
char a[2][100010], b[2][100010];
int f[100010][2], g[100010][2];
int main() {
  int n, m;
  scanf("%d%d%*d", &n, &m);
  scanf("%s%s%s%s", a[0] + 1, a[1] + 1, b[0] + 1, b[1] + 1);
  for (int i = 1; i <= m; i++)
    f[1][0] += (b[0][i] == 'R'), f[1][1] += (b[0][i] == 'B');
  f[1][0] += (a[0][1] == 'R') + (a[1][1] == 'R');
  f[1][1] += (a[0][1] == 'B') + (a[1][1] == 'B');
  for (int i = 2; i <= n; i++)
    f[i][0] =
        min(f[i - 1][0], f[i - 1][1] + m) + (a[0][i] == 'R') + (a[1][i] == 'R'),
    f[i][1] =
        min(f[i - 1][1], f[i - 1][0] + m) + (a[0][i] == 'B') + (a[1][i] == 'B');
  for (int i = 1; i <= m; i++)
    f[n][0] += (b[1][i] == 'R'), f[n][1] += (b[1][i] == 'B');
  for (int i = 1; i <= n; i++)
    g[1][0] += (a[0][i] == 'R'), g[1][1] += (a[0][i] == 'B');
  g[1][0] += (b[0][1] == 'R') + (b[1][1] == 'R');
  g[1][1] += (b[0][1] == 'B') + (b[1][1] == 'B');
  for (int i = 2; i <= m; i++)
    g[i][0] =
        min(g[i - 1][0], g[i - 1][1] + n) + (b[0][i] == 'R') + (b[1][i] == 'R'),
    g[i][1] =
        min(g[i - 1][1], g[i - 1][0] + n) + (b[0][i] == 'B') + (b[1][i] == 'B');
  for (int i = 1; i <= n; i++)
    g[m][0] += (a[1][i] == 'R'), g[m][1] += (a[1][i] == 'B');
  cout << min(min(g[m][0], g[m][1]), min(f[n][0], f[n][1])) << endl;
  return 0;
}
