#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
int n, m, k, px, py, pd;
long long res, res1;
map<int, set<int> > SA, SB;
set<int> S[maxn];
string st[4] = {"NE", "NW", "SE", "SW"};
int dx[] = {-1, -1, 1, 1};
int dy[] = {1, -1, 1, -1};
bool isB(int x, int y) {
  if (x < 0 || x >= n || y < 0 || y >= m) return true;
  return S[x].count(y);
}
void fI(int x, int y) {
  SA[x + y].insert(x);
  SB[x - y].insert(x);
}
bool doit(int &x, int &y, int &dir, long long &ans) {
  int sum = x + y, dif = x - y;
  if (dx[dir] + dy[dir] == 0) {
    set<int>::iterator it = SA[x + y].lower_bound(x);
    if (dir == 0) {
      if (it != SA[sum].begin()) {
        it--;
        ans += 1ll * abs(*it - x);
        x = *it + 1;
        y = sum - x;
      }
    } else
      ans += 1ll * abs(*it - x), x = *it - 1, y = sum - x;
  } else {
    set<int>::iterator it = SB[x - y].lower_bound(x);
    if (dir == 1) {
      if (it != SB[dif].begin()) {
        it--;
        ans += 1ll * abs(*it - x);
        x = *it + 1;
        y = x - dif;
      }
    } else
      ans += 1ll * abs(*it - x), x = *it - 1, y = x - dif;
  }
  if (isB(x + dx[dir], y) && isB(x, y + dy[dir])) {
    dir = 3 - dir;
    return false;
  }
  if (isB(x + dx[dir], y) == 0 && isB(x, y + dy[dir]) == 0) {
    dir = 3 - dir;
    return false;
  }
  if (isB(x + dx[dir], y))
    y += dy[dir], dir = (dir + 2) % 4;
  else
    x += dx[dir], dir += ((dir == 0 || dir == 2) ? 1 : -1);
  return true;
}
bool Go(int xx, int yy, int dirr) {
  set<pair<int, pair<int, int> > > state;
  while (!state.count(make_pair(dirr, make_pair(xx, yy)))) {
    state.insert(make_pair(dirr, make_pair(xx, yy)));
    if (!doit(xx, yy, dirr, res)) return false;
  }
  return true;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < k; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    S[x].insert(y);
    fI(x, y);
  }
  for (int i = -1; i <= n; i++) fI(i, -1), fI(i, m);
  for (int i = 0; i < m; i++) fI(-1, i), fI(n, i);
  int sx, sy, dir;
  string s;
  scanf("%d%d", &sx, &sy);
  cin >> s;
  sx--;
  sy--;
  for (int i = 0; i < 4; i++)
    if (st[i] == s) {
      dir = i;
      break;
    }
  doit(sx, sy, dir, res1);
  int xx = sx, yy = sy, dirr = dir;
  if (!Go(xx, yy, dirr)) {
    res--;
    Go(sx, sy, 3 - dir);
  }
  printf("%I64d\n", res);
  return 0;
}
