#include <bits/stdc++.h>
using namespace std;
template <typename T>
void setmax(T& x, T y) {
  x = max(x, y);
}
template <typename T>
void setmin(T& x, T y) {
  x = min(x, y);
}
const double PI = acos(-1.0);
const int INF = 1e9 + 47;
const long long LINF = 1LL * INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string arr[2][2];
int n, m, q;
int dpT[1 << 18][2];
int dp(int pos, int col) {
  if (dpT[pos][col] != -1) return dpT[pos][col];
  int cur = ((arr[0][0][pos] == 'R') ^ col) + ((arr[0][1][pos] == 'R') ^ col);
  if (pos == n - 1) {
    int ans = 0;
    for (int i = (0); i < (m); ++i)
      if ((arr[1][1][i] == 'R') ^ col) ans++;
    return dpT[pos][col] = ans + cur;
  }
  int ans = INF;
  for (int nx = (0); nx < (2); ++nx) {
    setmin(ans, dp(pos + 1, nx) + m * (nx ^ col));
  }
  return dpT[pos][col] = ans + cur;
}
int solve() {
  memset(dpT, -1, sizeof(dpT));
  int ans = INF;
  for (int col = (0); col < (2); ++col) {
    int res = dp(0, col);
    for (int i = (0); i < (m); ++i) res += (arr[1][0][i] == 'R') ^ col;
    setmin(ans, res);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> q;
  for (int i = (0); i < (2); ++i)
    for (int j = (0); j < (2); ++j) cin >> arr[i][j];
  int ans = INF;
  for (int sadsfsd = (0); sadsfsd < (2); ++sadsfsd) {
    setmin(ans, solve());
    swap(arr[0], arr[1]);
    swap(n, m);
  }
  cout << ans << endl;
  cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
