#include <bits/stdc++.h>
inline int read() {
  static int ret;
  static char cc;
  while (cc = getchar(), cc < '!')
    ;
  ret = cc - 48;
  while (cc = getchar(), cc > '!') ret = cc - 48 + ret * 10;
  return ret;
}
const int MAXN = 100010;
int N, M, K;
int Sx, Sy;
int To;
long long ans;
char cmd[3];
std::set<int> pool[MAXN << 2];
std::set<int> *mirrors1 = pool, *mirrors2 = pool + 300000;
std::set<std::pair<int, int> > vis;
void FindRoot(int x, int y, int to) {
  int y1, y2, x1, x2;
  while (1) {
    if (vis.count(std::make_pair(x, y))) return Sx = x, Sy = y, To = to, void();
    vis.insert(std::make_pair(x, y));
    switch (to) {
      case 0:
        y = *mirrors1[x].lower_bound(y);
        y1 = *--mirrors1[x - 1].lower_bound(y);
        y2 = *--mirrors1[x + 1].lower_bound(y);
        if (y1 == y - 1 && y2 == y - 1)
          return Sx = x, Sy = y - 2, To = 2, void();
        else if (y1 == y - 1)
          x = x + 1, y = y - 1, to = 3;
        else if (y2 == y - 1)
          x = x - 1, y = y - 1, to = 1;
        else
          return Sx = x, Sy = y - 2, To = 2, void();
        break;
      case 1:
        x = *--mirrors2[y].lower_bound(x);
        x1 = *mirrors2[y - 1].upper_bound(x);
        x2 = *mirrors2[y + 1].upper_bound(x);
        if (x1 == x + 1 && x2 == x + 1)
          return Sx = x + 2, Sy = y, To = 3, void();
        else if (x1 == x + 1)
          x = x + 1, y = y + 1, to = 0;
        else if (x2 == x + 1)
          x = x + 1, y = y - 1, to = 2;
        else
          return Sx = x + 2, Sy = y, To = 3, void();
        break;
      case 2:
        y = *--mirrors1[x].lower_bound(y);
        y1 = *mirrors1[x - 1].upper_bound(y);
        y2 = *mirrors1[x + 1].upper_bound(y);
        if (y1 == y + 1 && y2 == y + 1)
          return Sx = x, Sy = y + 2, To = 0, void();
        else if (y1 == y + 1)
          x = x + 1, y = y + 1, to = 3;
        else if (y2 == y + 1)
          x = x - 1, y = y + 1, to = 1;
        else
          return Sx = x, Sy = y + 2, To = 0, void();
        break;
      case 3:
        x = *mirrors2[y].lower_bound(x);
        x1 = *--mirrors2[y - 1].lower_bound(x);
        x2 = *--mirrors2[y + 1].lower_bound(x);
        if (x1 == x - 1 && x2 == x - 1)
          return Sx = x - 2, Sy = y, To = 1, void();
        else if (x1 == x - 1)
          x = x - 1, y = y + 1, to = 0;
        else if (x2 == x - 1)
          x = x - 1, y = y - 1, to = 2;
        else
          return Sx = x - 2, Sy = y, To = 1, void();
        break;
    }
  }
}
void Find(int x, int y, int to) {
  int y1, y2, x1, x2;
  bool flag = 1;
  ans++;
  while (1) {
    if (x == Sx && y == Sy) {
      if (flag)
        flag = 0;
      else
        return ans--, void();
    }
    switch (to) {
      case 0:
        y1 = *mirrors1[x].lower_bound(y);
        ans += (y1 - y) / 2 - 1, y = y1;
        y1 = *--mirrors1[x - 1].lower_bound(y);
        y2 = *--mirrors1[x + 1].lower_bound(y);
        if (y1 == y - 1 && y2 == y - 1)
          return;
        else if (y1 == y - 1)
          x = x + 1, y = y - 1, to = 3, ans++;
        else if (y2 == y - 1)
          x = x - 1, y = y - 1, to = 1, ans++;
        else
          return;
        break;
      case 1:
        x1 = *--mirrors2[y].lower_bound(x);
        ans += (x - x1) / 2 - 1, x = x1;
        x1 = *mirrors2[y - 1].upper_bound(x);
        x2 = *mirrors2[y + 1].upper_bound(x);
        if (x1 == x + 1 && x2 == x + 1)
          return;
        else if (x1 == x + 1)
          x = x + 1, y = y + 1, to = 0, ans++;
        else if (x2 == x + 1)
          x = x + 1, y = y - 1, to = 2, ans++;
        else
          return;
        break;
      case 2:
        y1 = *--mirrors1[x].lower_bound(y);
        ans += (y - y1) / 2 - 1, y = y1;
        y1 = *mirrors1[x - 1].upper_bound(y);
        y2 = *mirrors1[x + 1].upper_bound(y);
        if (y1 == y + 1 && y2 == y + 1)
          return;
        else if (y1 == y + 1)
          x = x + 1, y = y + 1, to = 3, ans++;
        else if (y2 == y + 1)
          x = x - 1, y = y + 1, to = 1, ans++;
        else
          return;
        break;
      case 3:
        x1 = *mirrors2[y].lower_bound(x);
        ans += (x1 - x) / 2 - 1, x = x1;
        x1 = *--mirrors2[y - 1].lower_bound(x);
        x2 = *--mirrors2[y + 1].lower_bound(x);
        if (x1 == x - 1 && x2 == x - 1)
          return;
        else if (x1 == x - 1)
          x = x - 1, y = y + 1, to = 0, ans++;
        else if (x2 == x - 1)
          x = x - 1, y = y - 1, to = 2, ans++;
        else
          return;
        break;
    }
  }
}
int main() {
  int x, y;
  N = read(), M = read(), K = read();
  for (int i = 1; i <= K; ++i) {
    x = read(), y = read();
    mirrors1[x + y].insert(x - y);
    mirrors2[x - y].insert(x + y);
  }
  for (int i = 0; i <= M + 1; ++i) {
    mirrors1[i].insert(-i), mirrors1[N + 1 + i].insert(N + 1 - i);
    mirrors2[-i].insert(i), mirrors2[N + 1 - i].insert(N + 1 + i);
  }
  for (int i = 1; i <= N; ++i) {
    mirrors1[i].insert(i), mirrors1[M + 1 + i].insert(i - M - 1);
    mirrors2[i].insert(i), mirrors2[i - M - 1].insert(M + 1 + i);
  }
  scanf("%d%d%s", &x, &y, cmd);
  if (cmd[0] == 'N') {
    if (cmd[1] == 'E')
      FindRoot(x + y, x - y, 2);
    else
      FindRoot(x + y, x - y, 1);
  } else {
    if (cmd[1] == 'W')
      FindRoot(x + y, x - y, 0);
    else
      FindRoot(x + y, x - y, 3);
  }
  Find(Sx, Sy, To);
  printf("%I64d\n", ans);
  return 0;
}
