#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;
struct cT {
  cT() {}
  cT(int _x, int _y) { setd(_x, _y); }
  void setd(int _x, int _y) { x = _x, y = _y; }
  bool operator<(const cT &a) const { return x < a.x; }
  int x, y;
};
int MOVE[4][2] = {-1, -1, -1, 1, 1, -1, 1, 1};
int n, m, k;
set<cT> mul[MAXN * 2], mur[MAXN * 2];
set<cT>::iterator it;
int cx[MAXN], cy[MAXN];
int ox, oy, odir, nx, ny, dir, tx, ty, tdir;
bool flag;
void init();
void input();
void work();
int getidl(int x, int y);
int getidr(int x, int y);
int move();
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < k; ++i) scanf("%d%d", &cx[i], &cy[i]);
  char s[5];
  scanf("%d%d%s", &ox, &oy, s);
  odir = 0;
  if (s[0] == 'S') odir += 2;
  if (s[1] == 'E') ++odir;
}
void work() {
  for (int i = 0; i <= n + 1; ++i) {
    mul[getidl(i, 0)].insert(cT(i, 0));
    mul[getidl(i, m + 1)].insert(cT(i, m + 1));
    mur[getidr(i, 0)].insert(cT(i, 0));
    mur[getidr(i, m + 1)].insert(cT(i, m + 1));
  }
  for (int i = 0; i <= m + 1; ++i) {
    mul[getidl(0, i)].insert(cT(0, i));
    mul[getidl(n + 1, i)].insert(cT(n + 1, i));
    mur[getidr(0, i)].insert(cT(0, i));
    mur[getidr(n + 1, i)].insert(cT(n + 1, i));
  }
  for (int i = 0; i < k; ++i) {
    mul[getidl(cx[i], cy[i])].insert(cT(cx[i], cy[i]));
    mur[getidr(cx[i], cy[i])].insert(cT(cx[i], cy[i]));
  }
  flag = false;
  bool runned;
  nx = ox, ny = oy, dir = odir;
  move();
  tx = nx, ty = ny, tdir = dir;
  runned = false;
  long long ans = 0;
  while (!flag && (!runned || !(nx == tx && ny == ty && dir == tdir))) {
    runned = true;
    ans += move();
    if (flag) break;
  }
  if (flag) {
    nx = ox, ny = oy, dir = odir;
    ans += move();
    nx = ox, ny = oy, dir = odir ^ 3;
    flag = false;
    ans += move();
    tx = nx, ty = ny, tdir = dir;
    runned = false;
    while (!flag && !runned || !(nx == tx && ny == ty && dir == tdir)) {
      runned = true;
      ans += move();
      if (flag) break;
    }
    --ans;
  }
  printf("%I64d\n", ans);
}
int move() {
  int vx, vy;
  if (!((dir & 1) ^ ((dir & 2) >> 1))) {
    int nid = getidl(nx, ny);
    it = mul[nid].upper_bound(cT(nx, ny));
    if (!(dir & 2)) --it;
  } else {
    int nid = getidr(nx, ny);
    it = mur[nid].upper_bound(cT(nx, ny));
    if (!(dir & 2)) --it;
  }
  vx = it->x - MOVE[dir][0], vy = it->y - MOVE[dir][1];
  int ans = (((vx - nx) >= 0) ? (vx - nx) : (-(vx - nx))) + 1;
  int nid = getidl(vx + MOVE[dir][0], vy);
  bool dxv = (mul[nid].find(cT(vx + MOVE[dir][0], vy)) != mul[nid].end());
  nid = getidl(vx, vy + MOVE[dir][1]);
  bool dyv = (mul[nid].find(cT(vx, vy + MOVE[dir][1])) != mul[nid].end());
  nx = vx, ny = vy;
  if (!(dxv ^ dyv))
    flag = true;
  else {
    if (dxv) {
      ny += MOVE[dir][1];
      dir ^= 2;
    } else {
      nx += MOVE[dir][0];
      dir ^= 1;
    }
  }
  return ans;
}
int getidl(int x, int y) {
  int id = y - x + 1;
  if (id < 0) id += MAXN;
  return id;
}
int getidr(int x, int y) { return (x + y + 1); }
