#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> tb;
class PT {
 public:
  int x, y, i;
  PT() {}
  PT(int _x, int _y) {
    x = _x + _y;
    y = _x - _y;
  }
};
PT pt[1000000];
int eg[1000000][4];
int pos[1000000][2];
int F, n, m;
bool cmpx(const PT& a, const PT& b) {
  if (a.x == b.x) {
    if (a.y == b.y) return a.i < b.i;
    return a.y < b.y;
  }
  return a.x < b.x;
}
bool cmpy(const PT& a, const PT& b) {
  if (a.y == b.y) {
    if (a.x == b.x) return a.i < b.i;
    return a.x < b.x;
  }
  return a.y < b.y;
}
bool cmp(const PT& a, const PT& b) { return a.i < b.i; }
inline int ABS(int x) { return x < 0 ? -x : x; }
inline int hit(int x, int y) {
  return x <= 0 || y <= 0 || x > n || y > m || tb[make_pair(x, y)];
}
int main() {
  int r, pn, x, y, i, j, k, sx, sy, sd, d, dx, dy, dd, f;
  long long sum;
  int a[4];
  char str[10];
  scanf("%d %d %d", &n, &m, &r);
  for (int i = 0; i < r; i++) {
    scanf("%d %d", &x, &y);
    tb[make_pair(x, y)] = 1;
  }
  scanf("%d %d %s", &sx, &sy, str);
  pn = 0;
  if (str[0] == 'S') {
    if (str[1] == 'E') {
      F = (sx + sy) % 2;
      pt[pn++] = PT(sx - 1, sy - 1);
      sd = 0;
    } else {
      F = (sx + sy + 1) % 2;
      pt[pn++] = PT(sx - 1, sy);
      sd = 1;
    }
  } else {
    if (str[1] == 'E') {
      F = (sx + sy + 1) % 2;
      pt[pn++] = PT(sx, sy - 1);
      sd = 3;
    } else {
      F = (sx + sy) % 2;
      pt[pn++] = PT(sx, sy);
      sd = 2;
    }
  }
  for (map<pair<int, int>, int>::iterator it = tb.begin(); it != tb.end();
       ++it) {
    x = it->first.first;
    y = it->first.second;
    if ((x + y) % 2 == F) {
      if (x != n && y != m) pt[pn++] = PT(x, y);
      if (x - 1 != 0 && y - 1 != 0) pt[pn++] = PT(x - 1, y - 1);
    } else {
      if (x - 1 != 0 && y != m) pt[pn++] = PT(x - 1, y);
      if (x != n && y - 1 != 0) pt[pn++] = PT(x, y - 1);
    }
  }
  for (x = 0; x <= n; x++) {
    if ((x + 0) % 2 == F) pt[pn++] = PT(x, 0);
    if ((x + m) % 2 == F) pt[pn++] = PT(x, m);
  }
  for (y = 1; y < m; y++) {
    if ((0 + y) % 2 == F) pt[pn++] = PT(0, y);
    if ((n + y) % 2 == F) pt[pn++] = PT(n, y);
  }
  for (i = 0; i < pn; i++) {
    pt[i].i = i;
    pos[i][0] = (pt[i].x + pt[i].y) / 2;
    pos[i][1] = (pt[i].x - pt[i].y) / 2;
  }
  memset(eg, -1, sizeof(eg));
  sort(pt, pt + pn, cmpx);
  for (i = 1, j = 0; i < pn; i++) {
    if (pt[i].x != pt[j].x || pt[i].y != pt[j].y) {
      pt[++j] = pt[i];
    }
  }
  pn = j + 1;
  pt[pn].x = 1000000000;
  pt[pn].y = 1000000000;
  for (i = 1, j = 0; i <= pn; i++) {
    if (pt[i].x != pt[i - 1].x) {
      for (j++; j < i; j++) {
        eg[pt[j - 1].i][1] = pt[j].i;
        eg[pt[j].i][3] = pt[j - 1].i;
      }
    }
  }
  sort(pt, pt + pn, cmpy);
  for (i = 1, j = 0; i <= pn; i++) {
    if (pt[i].y != pt[i - 1].y) {
      for (j++; j < i; j++) {
        eg[pt[j - 1].i][0] = pt[j].i;
        eg[pt[j].i][2] = pt[j - 1].i;
      }
    }
  }
  sort(pt, pt + pn, cmp);
  i = 0;
  d = sd;
  sum = 0;
  f = 0;
  while (1) {
    j = eg[i][d];
    sum += ABS(pos[j][0] - pos[i][0]) + ABS(pos[j][1] - pos[i][1]);
    a[0] = hit(pos[j][0] + 1, pos[j][1] + 1);
    a[1] = hit(pos[j][0] + 1, pos[j][1]);
    a[2] = hit(pos[j][0], pos[j][1]);
    a[3] = hit(pos[j][0], pos[j][1] + 1);
    if (a[d]) {
      if (a[(d + 1) % 4]) {
        if (a[(d + 3) % 4]) {
          if (f == 1) break;
          sum = 0;
          d = (d + 2) % 4;
          f++;
        } else {
          d = (d + 3) % 4;
        }
      } else {
        if (a[(d + 3) % 4]) {
          d = (d + 1) % 4;
        } else {
          if (f == 1) break;
          sum = 0;
          d = (d + 2) % 4;
          f++;
        }
      }
    }
    i = j;
    if (f == 0 && i == 0 && d == sd) {
      break;
    }
  }
  printf("%I64d\n", sum / 2);
  return 0;
}
