#include <bits/stdc++.h>
using namespace std;
int stmp;
const int MAX = 200020;
const int INF = 1000000001;
int a1[2 * MAX], a2[2 * MAX];
void add(int *a, int n, int x) {
  for (; n < 2 * MAX; n |= n + 1) a[n] += x;
}
int sum(int *a, int n) {
  if (n == -1) return 0;
  int s = 0;
  while (n >= 0) {
    s += a[n];
    n = (n & (n + 1)) - 1;
  }
  return s;
}
vector<int> slash[2 * MAX], bslash[2 * MAX];
int n, m;
inline int bsnr(int x, int y) { return x - y + MAX; }
inline int snr(int x, int y) { return x + y; }
inline int bsnr(pair<int, int> p) { return bsnr(p.first, p.second); }
inline int snr(pair<int, int> p) { return snr(p.first, p.second); }
inline int bsy(int s, int y) { return s - MAX + y; }
inline int bsx(int s, int x) { return x + MAX - s; }
inline int sx(int bs, int x) { return bs - x; }
inline int sy(int bs, int y) { return bs - y; }
inline void addCell(int x, int y) {
  slash[snr(x, y)].push_back(x);
  bslash[bsnr(x, y)].push_back(x);
}
inline bool exists(int x, int y) {
  return binary_search((bslash[bsnr(x, y)]).begin(), (bslash[bsnr(x, y)]).end(),
                       x);
}
void init() {
  for (int i = 0; i < (2 * MAX); ++i) {
    sort((slash[i]).begin(), (slash[i]).end());
    sort((bslash[i]).begin(), (bslash[i]).end());
  }
}
pair<int, int> move(pair<int, int> pos, pair<int, int> dir) {
  int x, y;
  if (dir == make_pair(-1, 1)) {
    int s = snr(pos.first, pos.second);
    x = *--lower_bound((slash[s]).begin(), (slash[s]).end(), pos.first);
    y = sx(s, x);
  } else if (dir == make_pair(-1, -1)) {
    int bs = bsnr(pos.first, pos.second);
    x = *--lower_bound((bslash[bs]).begin(), (bslash[bs]).end(), pos.first);
    y = bsx(bs, x);
  } else if (dir == make_pair(1, 1)) {
    int bs = bsnr(pos.first, pos.second);
    x = *lower_bound((bslash[bs]).begin(), (bslash[bs]).end(), pos.first);
    y = bsx(bs, x);
  } else {
    int s = snr(pos.first, pos.second);
    x = *lower_bound((slash[s]).begin(), (slash[s]).end(), pos.first);
    y = sx(s, x);
  }
  return make_pair(x, y);
}
pair<int, int> pos, dir;
struct event {
  int y, x1, x2;
  event() {}
  event(int _y, int _x1, int _x2) : y(_y), x1(_x1), x2(_x2) {}
  bool operator<(const event &rhs) const { return y < rhs.y; }
};
long long solve(vector<event> &E) {
  sort((E).begin(), (E).end());
  long long ret = 0;
  for (int i = 0; i < ((int)(E).size());) {
    int k = i + 1;
    while (k < ((int)(E).size()) && E[i].y == E[k].y) ++k;
    vector<pair<int, int> > v;
    for (int j = i; j < k; ++j) {
      v.push_back(make_pair(E[j].x1, -1));
      v.push_back(make_pair(E[j].x2, 1));
    }
    sort((v).begin(), (v).end());
    for (int j = 0; j < ((int)(v).size());) {
      assert(v[j].second == -1);
      int s = v[j].second;
      for (++j; s != 0; ++j) {
        s += v[j].second;
        ret += (v[j].first - v[j - 1].first);
      }
    }
    i = k;
  }
  return ret;
}
long long solve() {
  set<pair<pair<int, int>, pair<int, int> > > vis;
  vector<event> E[2];
  do {
    vis.insert(make_pair(pos, dir));
    pair<int, int> blocked = move(pos, dir);
    if (snr(pos) == snr(blocked)) {
      int x1 = bsnr(pos) / 2, x2 = bsnr(blocked) / 2;
      if (x1 > x2) {
        ++x1, ++x2;
        swap(x1, x2);
      }
      E[0].push_back(event(snr(pos), x1, x2));
    } else {
      int x1 = snr(pos) / 2, x2 = snr(blocked) / 2;
      if (x1 > x2) {
        ++x1;
        ++x2;
        swap(x1, x2);
      }
      E[1].push_back(event(bsnr(pos), x1, x2));
    }
    pair<int, int> nextpos, nextdir;
    bool bx = exists(blocked.first, blocked.second - dir.second);
    bool by = exists(blocked.first - dir.first, blocked.second);
    if (bx == by) {
      nextpos =
          make_pair(blocked.first - dir.first, blocked.second - dir.second);
      nextdir = make_pair(-dir.first, -dir.second);
    } else if (bx) {
      nextpos = make_pair(blocked.first - dir.first, blocked.second);
      nextdir = make_pair(-dir.first, dir.second);
    } else if (by) {
      nextpos = make_pair(blocked.first, blocked.second - dir.second);
      nextdir = make_pair(dir.first, -dir.second);
    }
    pos = nextpos;
    dir = nextdir;
  } while (vis.find(make_pair(pos, dir)) == vis.end());
  return solve(E[0]) + solve(E[1]);
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(0);
  int k;
  cin >> n >> m >> k;
  for (int i = (0); i <= (n + 1); ++i) addCell(i, 0), addCell(i, m + 1);
  for (int i = (1); i <= (m); ++i) addCell(0, i), addCell(n + 1, i);
  while (k--) {
    int x, y;
    cin >> x >> y;
    addCell(x, y);
  }
  init();
  cin >> pos.first >> pos.second;
  char d[3];
  cin >> d;
  dir = make_pair(d[0] == 'N' ? -1 : 1, d[1] == 'E' ? 1 : -1);
  cout << solve() << endl;
  return 0;
}
