#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, m, q, w1, w2, v[4][N][2], dp[N];
char f[4][N];
int main() {
  cin >> n >> m >> q;
  scanf("%s%s%s%s", f[0] + 1, f[1] + 1, f[2] + 1, f[3] + 1);
  for (int z = 0; z <= 3; z++) {
    int l = strlen(f[z] + 1);
    for (int i = 1; i <= l; i++) {
      v[z][i][0] = v[z][i - 1][0], v[z][i][1] = v[z][i - 1][1];
      if (f[z][i] == 'R')
        v[z][i][0]++;
      else
        v[z][i][1]++;
    }
  }
  int ans = min(v[0][n][0] + v[1][n][0] + v[2][m][0] + v[3][m][0],
                v[0][n][1] + v[1][n][1] + v[2][m][1] + v[3][m][1]);
  w1 = ans, w2 = ans;
  for (int i = 1; i <= n; i++) {
    dp[i] = m + min(v[2][m][0] + v[0][i][0] + v[1][i][0],
                    v[2][m][1] + v[0][i][1] + v[1][i][1]);
    dp[i] = min(min(dp[i], w1 + v[0][i][0] + v[1][i][0] + m),
                w2 + v[0][i][1] + v[1][i][1] + m);
    w1 = min(w1, dp[i] - v[0][i][0] - v[1][i][0]);
    w2 = min(w2, dp[i] - v[0][i][1] - v[1][i][1]);
    ans = min(ans, dp[i] + min(v[3][m][0] + v[0][n][0] - v[0][i][0] +
                                   v[1][n][0] - v[1][i][0],
                               v[3][m][1] + v[0][n][1] - v[0][i][1] +
                                   v[1][n][1] - v[1][i][1]));
  }
  w1 = ans, w2 = ans, swap(n, m);
  for (int i = 1; i <= n; i++) {
    dp[i] = m + min(v[0][m][0] + v[2][i][0] + v[3][i][0],
                    v[0][m][1] + v[2][i][1] + v[3][i][1]);
    dp[i] = min(min(dp[i], w1 + v[2][i][0] + v[3][i][0] + m),
                w2 + v[2][i][1] + v[3][i][1] + m);
    w1 = min(w1, dp[i] - v[2][i][0] - v[3][i][0]);
    w2 = min(w2, dp[i] - v[2][i][1] - v[3][i][1]);
    ans = min(ans, dp[i] + min(v[1][m][0] + v[2][n][0] - v[2][i][0] +
                                   v[3][n][0] - v[3][i][0],
                               v[1][m][1] + v[2][n][1] - v[2][i][1] +
                                   v[3][n][1] - v[3][i][1]));
  }
  cout << ans << endl;
}
