#include <bits/stdc++.h>
using namespace std;
const long long inf = 2147483647;
long long read() {
  long long first = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    first = first * 10 + ch - '0';
    ch = getchar();
  }
  return first * f;
}
void print(long long first) {
  if (first < 0) putchar('-'), first = -first;
  short a[20] = {}, sz = 0;
  while (first > 0) a[sz++] = first % 10, first /= 10;
  if (sz == 0) putchar('0');
  for (long long i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
long long n, m, k;
pair<long long, long long> sto[111111];
long long d;
set<long long> a[333333], b[333333];
set<pair<long long, long long> > stone;
inline void ins(long long first, long long second) {
  a[first - second + m + 1].insert(first);
  b[first + second].insert(first);
  stone.insert(make_pair(first, second));
}
struct state {
  long long first, second, dx, dy;
  bool operator<(state ano) const {
    if (first != ano.first) return first < ano.first;
    if (second != ano.second) return second < ano.second;
    if (dx != ano.dx) return dx < ano.dx;
    return dy < ano.dy;
  }
};
set<state> used;
inline bool blocked(long long first, long long second) {
  if (first < 1 || first > n || second < 1 || second > m ||
      stone.count(make_pair(first, second)))
    return 1;
  return 0;
}
state go(state fr, long long &dis) {
  dis = 0;
  if (fr.dx + fr.dy == 0) {
    set<long long>::iterator it = b[fr.first + fr.second].lower_bound(fr.first);
    if (fr.dx == -1) it--;
    dis += abs(fr.first - *it) - 1;
  } else {
    set<long long>::iterator it =
        a[fr.first - fr.second + m + 1].lower_bound(fr.first);
    if (fr.dx == -1) it--;
    dis += abs(fr.first - *it) - 1;
  }
  pair<long long, long long> shitou =
      make_pair(fr.first + dis * fr.dx, fr.second + dis * fr.dy);
  state ret;
  ret.first = shitou.first, ret.second = shitou.second;
  bool flag1 = blocked(shitou.first + fr.dx, shitou.second);
  bool flag2 = blocked(shitou.first, shitou.second + fr.dy);
  if (flag1 && flag2 || (!flag1) && (!flag2))
    ret.dx = -fr.dx, ret.dy = -fr.dy;
  else if (flag1)
    ret.dx = -fr.dx, ret.dy = fr.dy, ret.second += fr.dy;
  else if (flag2)
    ret.dx = fr.dx, ret.dy = -fr.dy, ret.first += fr.dx;
  dis++;
  return ret;
}
bool solve(state fr, long long &ans) {
  state nw = fr;
  while (used.find(nw) == used.end()) {
    used.insert(nw);
    long long res;
    state ano = go(nw, res);
    ans += res;
    if (ano.dx + nw.dx == 0 && ano.dy + nw.dy == 0) return 0;
    nw = ano;
  }
  return 1;
}
int main() {
  n = read(), m = read(), k = read();
  for (long long i = 1; i <= k; i++) {
    sto[i].first = read(), sto[i].second = read();
    ins(sto[i].first, sto[i].second);
  }
  for (long long i = 0; i <= n + 1; i++) {
    ins(i, 0);
    ins(i, m + 1);
  }
  for (long long j = 1; j <= m; j++) {
    ins(0, j);
    ins(n + 1, j);
  }
  state st;
  st.first = read(), st.second = read();
  string direction;
  cin >> direction;
  st.dx = (direction[0] == 'N') * (-2) + 1;
  st.dy = (direction[1] == 'W') * (-2) + 1;
  long long kkkkkk;
  st = go(st, kkkkkk);
  long long ans = 0;
  if (!solve(st, ans)) {
    long long ano = 0;
    st.dx = -st.dx;
    st.dy = -st.dy;
    solve(st, ano);
    ans = ans + ano - 1;
  }
  cout << ans << endl;
  return 0;
}
