#include <bits/stdc++.h>
using namespace std;
const int N = 120000;
int n, m, sx, sy;
bool ispie(int f) { return ((f & 1) ^ ((f >> 1) & 1)); }
map<int, bool> mp[N];
vector<int> pie[2 * N], na[2 * N];
long long ans;
int pieId(int x, int y) { return x + y; }
int naId(int x, int y) { return x - y + N; }
void insert(int x, int y) {
  mp[x][y] = 1;
  pie[pieId(x, y)].push_back(y);
  na[naId(x, y)].push_back(y);
}
void init(vector<int> &v) {
  sort(v.begin(), v.end());
  unique(v.begin(), v.end());
}
void find(int x, int y, int f, int &nx, int &ny) {
  if (ispie(f)) {
    int i = pieId(x, y),
        j = upper_bound(pie[i].begin(), pie[i].end(), y) - pie[i].begin();
    if (f & 1)
      ny = pie[i][j];
    else
      ny = (pie[i][j - 1] == y) ? (pie[i][j - 2]) : (pie[i][j - 1]);
    nx = x + y - ny;
    return;
  } else {
    int i = naId(x, y),
        j = upper_bound(na[i].begin(), na[i].end(), y) - na[i].begin();
    if (f & 1)
      ny = na[i][j];
    else
      ny = (na[i][j - 1] == y) ? (na[i][j - 2]) : (na[i][j - 1]);
    nx = x - y + ny;
    return;
  }
}
bool step = 0, flag = 0, flag2 = 0;
void nxt(int x, int y, int f, int &nx, int &ny, int &nf) {
  find(x, y, f, nx, ny);
  ans += abs(nx - x);
  if (nx == sx && ny == sy) {
    step = true;
    return;
  }
  mp[sx][sy] = 0;
  bool xg = mp[nx][ny + ((f & 1) ? (-1) : (1))],
       yg = mp[nx + (((f >> 1) & 1) ? (-1) : (1))][ny];
  mp[sx][sy] = 1;
  if (!(xg ^ yg)) {
    flag = true;
    return;
  }
  nf = f ^ ((int(xg) << 1) | int(yg));
  if (xg) {
    nx += ((f >> 1) & 1 ? (-1) : (1));
    return;
  }
  if (yg) {
    ny += (f & 1 ? (-1) : (1));
    return;
  }
}
void dfs(int x, int y, int f) {
  int nx, ny, nf;
  nxt(x, y, f, nx, ny, nf);
  if (flag || step || (nx == sx && ny == sy)) {
    return;
  } else {
    dfs(nx, ny, nf);
  }
  return;
}
int gf() {
  char s[15];
  scanf("%s", s);
  int res = 0;
  if (s[0] == 'S') res |= 2;
  if (s[1] == 'E') res |= 1;
  return res;
}
int main() {
  cin >> n >> m;
  int k;
  cin >> k;
  int x, y;
  for (int i = 1; i <= k; i++) {
    scanf("%d%d", &x, &y);
    insert(x, y);
  }
  for (int i = 0; i <= n + 1; i++) {
    insert(i, 0);
    insert(i, m + 1);
  }
  for (int i = 0; i <= m + 1; i++) {
    insert(0, i);
    insert(n + 1, i);
  }
  scanf("%d%d", &sx, &sy);
  insert(sx, sy);
  int f = gf();
  for (int i = 0; i < 2 * N; i++) {
    init(pie[i]);
    init(na[i]);
  }
  dfs(sx, sy, f);
  if (flag) {
    flag = 0;
    ans--;
    dfs(sx, sy, f ^ 3);
  }
  cout << ans << endl;
  return 0;
}
