#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f == 1 ? x : -x;
}
const int N = 2e5 + 4;
struct matrix {
  int a00, a01, a10, a11;
  inline void init(int x, int m) {
    a00 = x;
    a01 = 2 - x + m;
    a10 = x + m;
    a11 = 2 - x;
  }
  inline void out() {
    cout << a00 << " " << a01 << " " << a10 << " " << a11 << "\n";
  }
};
inline matrix operator*(const matrix &x, const matrix &y) {
  static matrix ret;
  ret.a00 = min(x.a00 + y.a00, x.a01 + y.a10);
  ret.a01 = min(x.a00 + y.a01, x.a01 + y.a11);
  ret.a10 = min(x.a10 + y.a00, x.a11 + y.a10);
  ret.a11 = min(x.a10 + y.a01, x.a11 + y.a11);
  return ret;
}
struct QWQ {
  int n, m, L[N], R[N];
  int t0[N << 2], t1[N << 2], len[N << 2], tL[N << 2], tR[N << 2];
  matrix t[N << 2][2][2];
  inline void pushup(int p) {
    t[p][0][0] = t[(p << 1)][0][0] * t[(p << 1 | 1)][0][0];
    t[p][0][1] = t[(p << 1)][0][1] * t[(p << 1 | 1)][0][1];
    t[p][1][0] = t[(p << 1)][1][0] * t[(p << 1 | 1)][1][0];
    t[p][1][1] = t[(p << 1)][1][1] * t[(p << 1 | 1)][1][1];
    tL[p] = tL[(p << 1)] + tL[(p << 1 | 1)];
    tR[p] = tR[(p << 1)] + tR[(p << 1 | 1)];
  }
  inline void pushnow(int p, int v0, int v1) {
    if (v0) {
      t0[p] ^= 1;
      tL[p] = len[p] - tL[p];
      swap(t[p][0][0], t[p][1][0]);
      swap(t[p][0][1], t[p][1][1]);
    }
    if (v1) {
      t1[p] ^= 1;
      tR[p] = len[p] - tR[p];
      swap(t[p][0][0], t[p][0][1]);
      swap(t[p][1][0], t[p][1][1]);
    }
  }
  inline void pushdown(int p) {
    if (!t0[p] && !t1[p]) return;
    pushnow((p << 1), t0[p], t1[p]);
    pushnow((p << 1 | 1), t0[p], t1[p]);
    t0[p] = t1[p] = 0;
  }
  void build(int p, int l, int r) {
    len[p] = r - l + 1;
    if (l == r) {
      tL[p] = L[r];
      tR[p] = R[r];
      t[p][0][0].init(L[r] + R[r], m);
      t[p][0][1].init(L[r] + (!R[r]), m);
      t[p][1][0].init((!L[r]) + R[r], m);
      t[p][1][1].init((!L[r]) + (!R[r]), m);
      return;
    }
    build((p << 1), l, ((l + r) >> 1));
    build((p << 1 | 1), ((l + r) >> 1) + 1, r);
    pushup(p);
  }
  void modify(int p, int l, int r, int ql, int qr, int v) {
    if (ql <= l && r <= qr) {
      pushnow(p, !v, v);
      return;
    }
    pushdown(p);
    if (ql <= ((l + r) >> 1)) modify((p << 1), l, ((l + r) >> 1), ql, qr, v);
    if (((l + r) >> 1) < qr)
      modify((p << 1 | 1), ((l + r) >> 1) + 1, r, ql, qr, v);
    pushup(p);
  }
  inline int getans(int f1, int v1) {
    matrix res, x;
    res.a00 = f1;
    res.a01 = m - f1;
    res.a10 = res.a11 = 1e9;
    res = res * t[1][0][0];
    return min(res.a00 + v1, res.a01 + m - v1);
  }
} t1, t2;
char s[N];
inline void Read(int *a, int n) {
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) a[i] = (s[i] == 'R');
}
int n, m, Q;
int main() {
  n = t1.n = t2.m = read();
  m = t1.m = t2.n = read();
  Q = read();
  Read(t1.L, n);
  Read(t1.R, n);
  Read(t2.L, m);
  Read(t2.R, m);
  t1.build(1, 1, n);
  t2.build(1, 1, m);
  cout << min(t1.getans(t2.tL[1], t2.tR[1]), t2.getans(t1.tL[1], t1.tR[1]))
       << "\n";
  for (int x, y; Q--;) {
    scanf("%s", s);
    x = read();
    y = read();
    switch (s[0]) {
      case 'U': {
        t2.modify(1, 1, m, x, y, 0);
        break;
      }
      case 'D': {
        t2.modify(1, 1, m, x, y, 1);
        break;
      }
      case 'L': {
        t1.modify(1, 1, n, x, y, 0);
        break;
      }
      case 'R': {
        t1.modify(1, 1, n, x, y, 1);
        break;
      }
    }
    cout << min(t1.getans(t2.tL[1], t2.tR[1]), t2.getans(t1.tL[1], t1.tR[1]))
         << "\n";
  }
  return (0 - 0);
}
