#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> sg;
pair<int, int> li[1000050];
int ln[1000050][4], n, m, p, st, wz[1000050][2], cur[1000050],
    *Cur = cur + 1000050 / 2;
int Wz[1000050][2], Sx, Sy, Sg;
char c[3];
bool d[1000050], f[1000050];
long long ans;
const int Dir[4][2] = {{-1, -1}, {-1, 0}, {0, -1}, {0, 0}};
inline int Read() {
  int x = 0;
  char y;
  do y = getchar();
  while (y < '0' || y > '9');
  do x = x * 10 + y - '0', y = getchar();
  while (y >= '0' && y <= '9');
  return x;
}
inline int Insert(int x, int y) {
  pair<int, int> k = make_pair(x, y);
  if (!sg[k]) sg[k] = ++st, Wz[st][0] = x, Wz[st][1] = y;
  return sg[k];
}
void Set_sg() {
  for (int i = 1; i <= p; i++)
    for (int j = 0; j < 4; j++)
      Insert(wz[i][0] + Dir[j][0], wz[i][1] + Dir[j][1]);
  for (int i = 0; i <= m; i++) Insert(0, i), Insert(n, i);
  for (int i = 0; i <= n; i++) Insert(i, 0), Insert(i, m);
  for (int i = 1; i <= p; i++)
    if (wz[i][1] == m) f[i] = true;
  return;
}
inline void Line(int x, int y, bool z = true) {
  if (x == y || !z) return;
  int k = abs(Wz[x][0] - Wz[y][0]), l = ln[x][0] ? 2 : 0;
  ln[x][l] = y;
  ln[x][l + 1] = k;
  l = ln[y][0] ? 2 : 0;
  ln[y][l] = x;
  ln[y][l + 1] = k;
}
void Set_Lines() {
  int now = 0;
  bool flag = (c[0] == 'N') ^ (c[1] == 'E'), Flag = false;
  if (!flag)
    Sg = Insert(--Sx, Sy);
  else
    Sg = Insert(Sx, Sy);
  for (int i = 1; i <= p; i++)
    li[++now].first = wz[i][0], li[now].second = wz[i][1];
  for (int i = 1; i <= n; i++) li[++now].first = i, li[now].second = 0;
  if (!flag) li[++now].first = Sx, li[now].second = Sy;
  sort(li + 1, li + now + 1);
  for (int i = 1; i <= m; i++) Cur[i] = sg[make_pair(0, i)];
  for (int i = 1; i <= n; i++) Cur[i + m] = sg[make_pair(i, m)];
  for (int i = 1; i <= now; i++)
    if (!li[i].second)
      Line(sg[make_pair(li[i].first, 0)], Cur[li[i].first],
           i == now || li[i + 1].first != li[i].first || li[i + 1].second != 1);
    else if (!flag && li[i].first == Sx && li[i].second == Sy && !Flag)
      Flag = true, Line(Sg, Cur[Sx + Sy]), Cur[Sx + Sy] = Sg;
    else {
      if (li[i].second != m && li[i].first != 1)
        Line(sg[make_pair(li[i].first - 1, li[i].second)],
             Cur[li[i].first - 1 + li[i].second]);
      Cur[li[i].first - 1 + li[i].second] =
          sg[make_pair(li[i].first, li[i].second - 1)];
    }
  for (int i = 1; i < m; i++) Line(sg[make_pair(n, i)], Cur[n + i]);
  now = p;
  for (int i = 1; i <= p; i++) li[i].first = wz[i][0], li[i].second = wz[i][1];
  for (int i = 1; i <= n; i++) li[++now].first = i, li[now].second = -1;
  if (flag) li[++now].first = Sx, li[now].second = Sy;
  sort(li + 1, li + now + 1);
  memset(cur, 0, sizeof(cur));
  for (int i = 0; i < m; i++) Cur[-i] = sg[make_pair(0, i)];
  for (int i = 1; i < n; i++) Cur[i] = sg[make_pair(i, 0)];
  for (int i = 1; i <= now; i++)
    if (li[i].second == -1)
      Line(sg[make_pair(li[i].first, m)], Cur[li[i].first - m],
           !f[li[i].first]);
    else if (li[i].first == Sx && li[i].second == Sy && flag && !Flag)
      Flag = true, Line(Sg, Cur[Sx - Sy]), Cur[Sx - Sy] = Sg;
    else {
      if (li[i].second != 1 && li[i].first != 1)
        Line(sg[make_pair(li[i].first - 1, li[i].second - 1)],
             Cur[li[i].first - li[i].second]);
      Cur[li[i].first - li[i].second] =
          sg[make_pair(li[i].first, li[i].second)];
    }
  for (int i = 1; i < m; i++) Line(sg[make_pair(n, i)], Cur[n - i]);
}
void DFS(int x) {
  if (!x || d[x]) return;
  d[x] = true;
  ans += ln[x][1] + ln[x][3];
  DFS(ln[x][0]);
  DFS(ln[x][2]);
}
int main() {
  n = Read();
  m = Read();
  p = Read();
  if (n == 1 && m == 1) {
    puts("1");
    return 0;
  }
  for (int i = 1; i <= p; i++) wz[i][0] = Read(), wz[i][1] = Read();
  scanf("%d%d%s", &Sx, &Sy, c);
  Set_sg();
  Set_Lines();
  DFS(Sg);
  cout << ans / 2 << endl;
  return 0;
}
