#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
}
using namespace std;
inline void MIN(int &a, int b) {
  if (b < a) a = b;
}
inline void MAX(int &a, int b) {
  if (a < b) a = b;
}
inline int F(int x) { return x < 0 ? -x : x; }
int n, m, k;
set<int> st[101000 << 2];
int dx[4] = {-1, -1, 1, 1};
int dy[4] = {1, -1, 1, -1};
inline int Id(int x, int y, int t) {
  if (t == 0 || t == 3) {
    return x + y - 1;
  } else {
    return n + m - 1 + x - y + m;
  }
}
inline bool ban(int x, int y) {
  if (x < 1 || x > n || y < 1 || y > m) return true;
  return st[x + y - 1].find(x) != st[x + y - 1].end();
}
int sx, sy, sd;
bool flag;
inline void FanShe(int &x, int &y, int &d) {
  if (!(ban(x + dx[d], y) ^ ban(x, y + dy[d])))
    return flag = true, d ^= 3, void();
  if (ban(x + dx[d], y))
    d ^= 2, y += dy[d];
  else
    d ^= 1, x += dx[d];
}
int ceilx[101000 << 2], bottomx[101000 << 2];
void find_nxt(int x, int y, int d, int &tx, int &ty) {
  if (d < 2) {
    set<int>::iterator it = st[Id(x, y, d)].lower_bound(x);
    if (!st[Id(x, y, d)].size() || it == st[Id(x, y, d)].begin())
      tx = ceilx[Id(x, y, d)];
    else
      tx = *(--it) + 1;
    ty = y + (d ? -1 : 1) * F(x - tx);
  } else {
    set<int>::iterator it = st[Id(x, y, d)].lower_bound(x);
    if (it == st[Id(x, y, d)].end())
      tx = bottomx[Id(x, y, d)];
    else
      tx = *it - 1;
    ty = y + (d & 1 ? -1 : 1) * F(x - tx);
  }
}
int sol(int &x, int &y, int &d) {
  int tx, ty, td = d;
  find_nxt(x, y, d, tx, ty);
  int res = F(tx - x) + 1;
  FanShe(tx, ty, td);
  x = tx, y = ty, d = td;
  return res;
}
void work() {
  int nx, ny, nd;
  sol(sx, sy, sd);
  nx = sx, ny = sy, nd = sd;
  long long ans = 0;
  do {
    ans += sol(nx, ny, nd);
  } while (nx != sx || ny != sy || nd != sd);
  if (flag) ans >>= 1;
  printf("%lld\n", ans);
}
int main() {
  read(n), read(m), read(k);
  for (int i = 1; i <= k; ++i) {
    int x, y;
    read(x), read(y);
    st[Id(x, y, 0)].insert(x);
    st[Id(x, y, 1)].insert(x);
  }
  memset(ceilx, 0x3f, sizeof(ceilx));
  for (int i = 1; i <= n; ++i)
    for (int d = 0; d < 4; ++d)
      MAX(bottomx[Id(i, 1, d)], i), MAX(bottomx[Id(i, m, d)], i),
          MIN(ceilx[Id(i, 1, d)], i), MIN(ceilx[Id(i, m, d)], i);
  for (int j = 1; j <= m; ++j)
    for (int d = 0; d < 4; ++d)
      MAX(bottomx[Id(n, j, d)], n), MIN(ceilx[Id(1, j, d)], 1);
  read(sx), read(sy);
  char tp[5];
  scanf("%s", tp);
  if (tp[0] == 'N')
    if (tp[1] == 'E')
      sd = 0;
    else
      sd = 1;
  else if (tp[1] == 'E')
    sd = 2;
  else
    sd = 3;
  work();
  return 0;
}
