#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > sp[2];
void add(int x, int y) {
  sp[0].push_back(pair<int, int>(x - y, x));
  sp[1].push_back(pair<int, int>(x + y, x));
}
long long ans;
int dx, dy, sx, sy, x, y, flag;
string s;
void solve() {
  int dir = (dx != dy);
  pair<int, int> p = dir ? pair<int, int>(x + y, x) : pair<int, int>(x - y, x);
  vector<pair<int, int> >::iterator it =
      upper_bound(sp[dir].begin(), sp[dir].end(), p);
  while (it->first != p.first) it--;
  if (dx < 0)
    while (it->second >= x) it--;
  ans += abs(x - (it->second)) - 1;
  x = it->second;
  y = dir ? (it->first - x) : (x - it->first);
  bool A = binary_search(sp[0].begin(), sp[0].end(),
                         pair<int, int>(x - y - dx, x - dx));
  bool B =
      binary_search(sp[0].begin(), sp[0].end(), pair<int, int>(x - y + dy, x));
  if (A == B) {
    flag = 1;
    dx = -dx;
    dy = -dy;
  } else if (A) {
    x -= dx;
    dy = -dy;
  } else if (B) {
    y -= dy;
    dx = -dx;
  }
}
int main() {
  int n, m, k, i, j;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= m; i++) add(0, i), add(n + 1, i);
  for (i = 0; i <= n + 1; i++) add(i, 0), add(i, m + 1);
  for (i = 1; i <= k; i++) scanf("%d%d", &x, &y), add(x, y);
  cin >> x >> y >> s;
  dx = (s[0] == 'N' ? -1 : 1);
  dy = (s[1] == 'W' ? -1 : 1);
  sort(sp[0].begin(), sp[0].end());
  sort(sp[1].begin(), sp[1].end());
  solve();
  int sx = x, sy = y, sdx = dx, sdy = dy;
  ans = 0;
  do {
    solve();
  } while (!(sx == x && sy == y && sdx == dx && sdy == dy));
  printf("%lld\n", flag ? (ans >> 1) : ans);
  return 0;
}
