#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
int n, m, k, sx, sy, sd, tx, ty, td, v = 1;
long long ans;
int dx[5] = {-1, -1, 1, 1}, dy[5] = {1, -1, -1, 1};
string str;
map<int, int> b[200010];
set<pair<int, int> > s[200010][2];
void add(int x, int y) {
  b[x][y] = true, s[x + y][0].insert({x, y}),
  s[x - y + m + 1][1].insert({x, y});
}
void work(int type) {
  set<pair<int, int> >::iterator it =
      s[sd & 1 ? sx - sy + m + 1 : sx + sy][sd & 1].lower_bound({sx, sy});
  if (sd <= 1) it--;
  if (type) ans += abs(sx - it->first);
  sx = it->first - dx[sd], sy = it->second - dy[sd];
  int cnt = b[sx + dx[sd]].count(sy) + b[sx].count(sy + dy[sd]);
  if (!cnt || cnt == 2)
    sd = (sd + 2) % 4, v = 2;
  else {
    if (b[sx + dx[sd]].count(sy))
      sy += dy[sd], sd = 3 - sd;
    else
      sx += dx[sd], sd ^= 1;
  }
}
int main() {
  read(n), read(m), read(k);
  for (int i = 0; i <= n + 1; ++i) add(i, 0), add(i, m + 1);
  for (int i = 0; i <= m + 1; ++i) add(0, i), add(n + 1, i);
  for (int i = 1; i <= k; ++i) {
    int x, y;
    read(x), read(y), add(x, y);
  }
  read(sx), read(sy), cin >> str;
  if (str == "NE") sd = 0;
  if (str == "NW") sd = 1;
  if (str == "SW") sd = 2;
  if (str == "SE") sd = 3;
  work(0), tx = sx, ty = sy, td = sd, work(1);
  while (sx != tx || sy != ty || sd != td) work(1);
  printf("%lld", ans / v);
  return 0;
}
