#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int INF = 100000000;
class SegTree {
 public:
  SegTree(int _n, int _m) : n(_n), m(_m) {
    x = y = cx = cy = vector<int>(_n * 4);
    fx = fy = vector<bool>(_n * 4);
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          for (int l = 0; l < 2; ++l) {
            f[i][j][k][l] = vector<int>(_n * 4);
          }
        }
      }
    }
  }
  void Calculate(int t) {
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          for (int l = 0; l < 2; ++l) {
            f[i][j][k][l][t] = INF;
            for (int p = 0; p < 2; ++p) {
              for (int q = 0; q < 2; ++q) {
                int add = p == q ? 0 : m;
                f[i][j][k][l][t] =
                    min(f[i][j][k][l][t],
                        f[i][j][k][p][t + t] + f[i][j][q][l][t + t + 1] + add);
              }
            }
          }
        }
      }
    }
  }
  void Build(int t, int l, int r) {
    if (l == r) {
      cx[t] = x[l];
      cy[t] = y[l];
      for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
          int xone = 1 ^ i;
          int yone = 1 ^ j;
          f[i][j][0][0][t] = (x[l] == xone) + (y[l] == yone);
          f[i][j][1][1][t] = (x[l] != xone) + (y[l] != yone);
          f[i][j][0][1][t] = f[i][j][1][0][t] = INF;
        }
      }
      return;
    }
    int mid = (l + r) >> 1;
    Build(t + t, l, mid);
    Build(t + t + 1, mid + 1, r);
    cx[t] = cx[t + t] + cx[t + t + 1];
    cy[t] = cy[t + t] + cy[t + t + 1];
    Calculate(t);
  }
  void SwapX(int t, int l, int r) {
    fx[t] = !fx[t];
    cx[t] = r - l + 1 - cx[t];
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 2; ++k) {
        for (int l = 0; l < 2; ++l) {
          swap(f[0][j][k][l][t], f[1][j][k][l][t]);
        }
      }
    }
  }
  void SwapY(int t, int l, int r) {
    fy[t] = !fy[t];
    cy[t] = r - l + 1 - cy[t];
    for (int i = 0; i < 2; ++i) {
      for (int k = 0; k < 2; ++k) {
        for (int l = 0; l < 2; ++l) {
          swap(f[i][0][k][l][t], f[i][1][k][l][t]);
        }
      }
    }
  }
  void PushDown(int t, int l, int r) {
    if (l == r) return;
    if (fx[t]) {
      int mid = (l + r) >> 1;
      SwapX(t + t, l, mid);
      SwapX(t + t + 1, mid + 1, r);
      fx[t] = false;
    }
    if (fy[t]) {
      int mid = (l + r) >> 1;
      SwapY(t + t, l, mid);
      SwapY(t + t + 1, mid + 1, r);
      fy[t] = false;
    }
  }
  void Insert(int t, bool isx, int l, int r, int p, int q) {
    PushDown(t, l, r);
    if (p <= l && r <= q) {
      if (isx) {
        SwapX(t, l, r);
      } else {
        SwapY(t, l, r);
      }
      return;
    }
    int mid = (l + r) >> 1;
    if (p <= mid) Insert(t + t, isx, l, mid, p, q);
    if (mid + 1 <= q) Insert(t + t + 1, isx, mid + 1, r, p, q);
    cx[t] = cx[t + t] + cx[t + t + 1];
    cy[t] = cy[t + t] + cy[t + t + 1];
    Calculate(t);
  }
  int Query(int a, int b) { return f[0][0][a][b][1]; }
  int QueryX(int a) {
    if (a == 1) return n - cx[1];
    return cx[1];
  }
  int QueryY(int a) {
    if (a == 1) return n - cy[1];
    return cy[1];
  }
  int n, m;
  vector<int> x, y;
  vector<int> cx, cy;
  vector<bool> fx, fy;
  vector<int> f[2][2][2][2];
};
int GetAns(int n, int m, SegTree& lrtree, SegTree& udtree) {
  int ans = INF;
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      ans = min(ans, lrtree.Query(i, j) + udtree.QueryX(i) + udtree.QueryY(j));
      ans = min(ans, udtree.Query(i, j) + lrtree.QueryX(i) + lrtree.QueryY(j));
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  string l, r, u, d;
  cin >> l >> r >> u >> d;
  SegTree lrtree(n, m), udtree(m, n);
  for (int i = 0; i < n; ++i) {
    if (l[i] == 'R') lrtree.x[i + 1] = 1;
    if (r[i] == 'R') lrtree.y[i + 1] = 1;
  }
  for (int i = 0; i < m; ++i) {
    if (u[i] == 'R') udtree.x[i + 1] = 1;
    if (d[i] == 'R') udtree.y[i + 1] = 1;
  }
  lrtree.Build(1, 1, n);
  udtree.Build(1, 1, m);
  cout << GetAns(n, m, lrtree, udtree) << endl;
  for (int i = 0; i < q; ++i) {
    char c;
    int a, b;
    cin >> c >> a >> b;
    if (c == 'L') {
      lrtree.Insert(1, true, 1, n, a, b);
    } else if (c == 'R') {
      lrtree.Insert(1, false, 1, n, a, b);
    } else if (c == 'U') {
      udtree.Insert(1, true, 1, m, a, b);
    } else {
      udtree.Insert(1, false, 1, m, a, b);
    }
    cout << GetAns(n, m, lrtree, udtree) << endl;
  }
  return 0;
}
