#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s[2][200000 + 5];
int n, m;
void add(int x, int y) {
  s[0][x + y].insert(make_pair((x), (y))),
      s[1][x - y + m].insert(make_pair((x), (y)));
}
bool check(int x, int y) {
  set<pair<int, int> >::iterator it =
      s[0][x + y].lower_bound(make_pair((x), (y)));
  return (*it) == make_pair((x), (y));
}
pair<pair<int, int>, int> getnxt(pair<pair<int, int>, int> now) {
  int flag = now.second;
  bool a, b;
  pair<pair<int, int>, int> nxt;
  if (flag == 0) {
    set<pair<int, int> >::iterator it =
        s[0][now.first.first + now.first.second].lower_bound(now.first);
    it--;
    a = check((*it).first + 1, (*it).second),
    b = check((*it).first, (*it).second - 1);
    if (a == b)
      nxt.first = make_pair(((*it).first + 1), ((*it).second - 1)),
      nxt.second = 3;
    else {
      if (a)
        nxt.first = make_pair(((*it).first), ((*it).second - 1)),
        nxt.second = 1;
      if (b)
        nxt.first = make_pair(((*it).first + 1), ((*it).second)),
        nxt.second = 2;
    }
  } else if (flag == 1) {
    set<pair<int, int> >::iterator it =
        s[1][now.first.first - now.first.second + m].lower_bound(now.first);
    it--;
    a = check((*it).first + 1, (*it).second),
    b = check((*it).first, (*it).second + 1);
    if (a == b)
      nxt.first = make_pair(((*it).first + 1), ((*it).second + 1)),
      nxt.second = 2;
    else {
      if (a)
        nxt.first = make_pair(((*it).first), ((*it).second + 1)),
        nxt.second = 0;
      if (b)
        nxt.first = make_pair(((*it).first + 1), ((*it).second)),
        nxt.second = 3;
    }
  } else if (flag == 2) {
    set<pair<int, int> >::iterator it =
        s[1][now.first.first - now.first.second + m].lower_bound(now.first);
    a = check((*it).first - 1, (*it).second),
    b = check((*it).first, (*it).second - 1);
    if (a == b)
      nxt.first = make_pair(((*it).first - 1), ((*it).second - 1)),
      nxt.second = 1;
    else {
      if (a)
        nxt.first = make_pair(((*it).first), ((*it).second - 1)),
        nxt.second = 3;
      if (b)
        nxt.first = make_pair(((*it).first - 1), ((*it).second)),
        nxt.second = 0;
    }
  } else {
    set<pair<int, int> >::iterator it =
        s[0][now.first.first + now.first.second].lower_bound(now.first);
    a = check((*it).first - 1, (*it).second),
    b = check((*it).first, (*it).second + 1);
    if (a == b)
      nxt.first = make_pair(((*it).first - 1), ((*it).second + 1)),
      nxt.second = 0;
    else {
      if (a)
        nxt.first = make_pair(((*it).first), ((*it).second + 1)),
        nxt.second = 2;
      if (b)
        nxt.first = make_pair(((*it).first - 1), ((*it).second)),
        nxt.second = 1;
    }
  }
  return nxt;
}
int main() {
  int k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
  }
  for (int i = 0; i <= m; i++) add(0, i), add(n + 1, m + 1 - i);
  for (int i = 0; i <= n; i++) add(i, m + 1), add(n + 1 - i, 0);
  char ss[3];
  int sx, sy, flag;
  scanf("%d%d", &sx, &sy);
  scanf("%s", ss);
  if (ss[0] == 'N') {
    if (ss[1] == 'E')
      flag = 0;
    else
      flag = 1;
  } else {
    if (ss[1] == 'E')
      flag = 2;
    else
      flag = 3;
  }
  pair<pair<int, int>, int> st = getnxt(
                                make_pair((make_pair((sx), (sy))), (flag))),
                            now = st;
  long long ans = 0;
  bool rev = 0;
  while (1) {
    pair<pair<int, int>, int> nxt = getnxt(now);
    ans += max(abs(now.first.first - nxt.first.first),
               abs(now.first.second - nxt.first.second));
    if ((nxt.second ^ 3) == now.second) {
      ans++;
      rev = 1;
    }
    if (nxt == st) break;
    now = nxt;
  }
  if (rev) ans >>= 1;
  printf("%lld\n", ans);
  return 0;
}
