#include <bits/stdc++.h>
using namespace std;
vector<int> d1[300000];
vector<int> d2[300000];
int n, m, q;
int x[100001], y[100001];
long long cnt = 0;
int sx, sy;
int sdx, sdy;
bool mark;
int find1(int x1, int y1) {
  int l = 0;
  int r = d1[x1].size() - 1;
  int mid, re = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (d1[x1][mid] > y1)
      r = mid - 1;
    else
      re = mid, l = mid + 1;
  }
  return re;
}
int find2(int x1, int y1) {
  int l = 0;
  int r = d2[y1].size() - 1;
  int mid, re = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (d2[y1][mid] > x1)
      r = mid - 1;
    else
      re = mid, l = mid + 1;
  }
  return re;
}
bool check(int x0, int y0) {
  int tx = x0 + y0;
  int ty = x0 - y0 + m;
  int t1 = find1(tx, ty);
  int x1 = (d1[tx][t1] + tx - m) / 2;
  int y1 = (tx - d1[tx][t1] + m) / 2;
  return x0 == x1 && y0 == y1;
}
void move(int &x0, int &y0, int &dirx, int &diry, int flag) {
  int tx = x0 + y0;
  int ty = x0 - y0 + m;
  int dx, dy, nx, ny;
  int t1, x1, y1;
  if (dirx == diry) {
    t1 = find2(tx, ty);
    if (dirx == 1) t1++;
    x1 = (d2[ty][t1] + ty - m) / 2;
    y1 = (d2[ty][t1] - ty + m) / 2;
  } else {
    t1 = find1(tx, ty);
    if (dirx == 1) t1++;
    x1 = (d1[tx][t1] + tx - m) / 2;
    y1 = (tx - d1[tx][t1] + m) / 2;
  }
  bool o1 = check(x1 - dirx, y1);
  bool o2 = check(x1, y1 - diry);
  if ((o1 && o2) || ((!o1) && (!o2))) {
    mark = true;
    dx = x1 - dirx;
    dy = y1 - diry;
    nx = -dirx;
    ny = -diry;
  } else if (o1) {
    dx = x1;
    dy = y1 - diry;
    nx = dirx;
    ny = -diry;
  } else {
    dx = x1 - dirx;
    dy = y1;
    nx = -dirx;
    ny = diry;
  }
  cnt += (long long)((x1 - x0) * dirx * flag);
  x0 = dx;
  y0 = dy;
  dirx = nx;
  diry = ny;
  return;
}
void go(int x0, int y0, int dirx, int diry) {
  while (true) {
    move(x0, y0, dirx, diry, 1);
    if (x0 == sx && y0 == sy && dirx == sdx && diry == sdy) return;
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  n++;
  m++;
  for (int i = 1; i <= q; i++) {
    scanf("%d%d", &x[i], &y[i]);
    d1[x[i] + y[i]].push_back(x[i] - y[i] + m);
    d2[x[i] - y[i] + m].push_back(x[i] + y[i]);
  }
  for (int i = 0; i <= n; i++) {
    d1[i + 0].push_back(i - 0 + m);
    d2[i - 0 + m].push_back(i + 0);
    d1[i + m].push_back(i - m + m);
    d2[i - m + m].push_back(i + m);
  }
  for (int i = 1; i < m; i++) {
    d1[i + 0].push_back(0 - i + m);
    d2[0 - i + m].push_back(i + 0);
    d1[i + n].push_back(n - i + m);
    d2[n - i + m].push_back(i + n);
  }
  int x0, y0, dirx, diry;
  char c[10];
  scanf("%d%d", &x0, &y0);
  scanf("%s", c);
  if (c[0] == 'S')
    dirx = 1;
  else
    dirx = -1;
  if (c[1] == 'E')
    diry = 1;
  else
    diry = -1;
  for (int i = 0; i <= n + m; i++) sort(d1[i].begin(), d1[i].end());
  for (int i = 0; i <= n + m; i++) sort(d2[i].begin(), d2[i].end());
  move(x0, y0, dirx, diry, 0);
  sx = x0, sy = y0;
  sdx = dirx, sdy = diry;
  go(x0, y0, dirx, diry);
  printf("%I64d\n", cnt / (mark ? 2ll : 1ll));
  return 0;
}
