#include <bits/stdc++.h>
using namespace std;
int n, m, t, sx, sy, ix, iy, cx, cy, dx, dy, there_is_my_star, here_is_my_star;
char op[5];
long long i_find_my_star;
bool flag;
vector<int> x[100007 * 2], y[100007 * 2];
inline int i_need_its_x(int a, int b) { return a + b - 1; }
inline int i_need_its_y(int a, int b) { return m + a - b; }
inline int star_has_its_x(int id, int x) { return id - x + 1; }
inline int star_has_its_y(int id, int x) { return x + m - id; }
inline void where_the_ray_go() {
  if (dx == 1) {
    if (dy == 1) {
      int id = i_need_its_y(cx, cy);
      there_is_my_star =
          y[id][lower_bound(y[id].begin(), y[id].end(), cx) - y[id].begin()];
      here_is_my_star = star_has_its_y(id, there_is_my_star);
    } else {
      int id = i_need_its_x(cx, cy);
      there_is_my_star =
          x[id][lower_bound(x[id].begin(), x[id].end(), cx) - x[id].begin()];
      here_is_my_star = star_has_its_x(id, there_is_my_star);
    }
  } else {
    if (dy == 1) {
      int id = i_need_its_x(cx, cy);
      there_is_my_star = x[id][lower_bound(x[id].begin(), x[id].end(), cx) -
                               x[id].begin() - 1];
      here_is_my_star = star_has_its_x(id, there_is_my_star);
    } else {
      int id = i_need_its_y(cx, cy);
      there_is_my_star = y[id][lower_bound(y[id].begin(), y[id].end(), cx) -
                               y[id].begin() - 1];
      here_is_my_star = star_has_its_y(id, there_is_my_star);
    }
  }
}
inline bool maybe_that_is_my_star(int a, int b, int c) {
  if (a == c) {
    return 0;
  }
  if (a > c) {
    swap(a, c);
  }
  if (a < b && b < c) {
    return 1;
  }
  return 0;
}
inline bool where_is_my_star() {
  if (abs(cx - sx) != abs(cy - sy) || ix != dx || iy != dy ||
      (cx - sx) / dx > 0 || (cy - sy) / dy > 0 ||
      maybe_that_is_my_star(cx, there_is_my_star, sx)) {
    return 0;
  }
  i_find_my_star += (long long)abs(cx - sx);
  return 1;
}
inline bool how_will_the_ray_go(int tx, int ty) {
  int id1 = i_need_its_x(tx, ty), id2 = i_need_its_y(tx, ty);
  int sz1 = x[id1].size(), sz2 = y[id2].size();
  if (sz1 < sz2) {
    for (int i = 0; i < (int)x[id1].size(); i++) {
      if (x[id1][i] == tx) {
        return 1;
      }
    }
  } else {
    for (int i = 0; i < (int)y[id2].size(); i++) {
      if (y[id2][i] == tx) {
        return 1;
      }
    }
  }
  return 0;
}
inline void my_star_stops_the_ray() {
  if (flag) {
    printf("%lld\n", i_find_my_star), exit(0);
  }
  flag = 1, cx = sx, cy = sy, dx = -ix, dy = -iy, i_find_my_star--;
}
inline void ray_pass_my_star() {
  i_find_my_star += abs(there_is_my_star - cx), cx = there_is_my_star,
                                                cy = here_is_my_star;
  if (dx == 1) {
    if (dy == 1) {
      bool find_that_star =
               how_will_the_ray_go(there_is_my_star, here_is_my_star - 1),
           how_to_find_my_star =
               how_will_the_ray_go(there_is_my_star - 1, here_is_my_star);
      if (find_that_star == how_to_find_my_star) {
        my_star_stops_the_ray();
      } else {
        if (find_that_star) {
          cx--, dx = -1, dy = 1;
        }
        if (how_to_find_my_star) {
          cy--, dx = 1, dy = -1;
        }
      }
    } else {
      bool robs = how_will_the_ray_go(there_is_my_star, here_is_my_star + 1),
           how_to_find_my_star =
               how_will_the_ray_go(there_is_my_star - 1, here_is_my_star);
      if (robs == how_to_find_my_star) {
        my_star_stops_the_ray();
      } else {
        if (robs) {
          cx--, dx = -1, dy = -1;
        }
        if (how_to_find_my_star) {
          cy++, dx = 1, dy = 1;
        }
      }
    }
  } else {
    if (dy == 1) {
      bool find_that_star =
               how_will_the_ray_go(there_is_my_star, here_is_my_star - 1),
           find_this_star =
               how_will_the_ray_go(there_is_my_star + 1, here_is_my_star);
      if (find_that_star == find_this_star) {
        my_star_stops_the_ray();
      } else {
        if (find_that_star) {
          cx++, dx = 1, dy = 1;
        }
        if (find_this_star) {
          cy--, dx = -1, dy = -1;
        }
      }
    } else {
      bool robs = how_will_the_ray_go(there_is_my_star, here_is_my_star + 1),
           find_this_star =
               how_will_the_ray_go(there_is_my_star + 1, here_is_my_star);
      if (robs == find_this_star) {
        my_star_stops_the_ray();
      } else {
        if (robs) {
          cx++, dx = 1, dy = -1;
        }
        if (find_this_star) {
          cy++, dx = -1, dy = 1;
        }
      }
    }
  }
}
int main() {
  int a, b;
  scanf("%d%d%d", &n, &m, &t);
  for (int i = 1; i <= t; i++) {
    scanf("%d%d", &a, &b);
    x[i_need_its_x(a, b)].push_back(a);
    y[i_need_its_y(a, b)].push_back(a);
  }
  for (int i = 0; i <= n + m; i++) {
    x[i].push_back(max(0, i - m));
    x[i].push_back(min(n + 1, i + 1));
    y[i].push_back(max(0, i - m));
    y[i].push_back(min(n + 1, i + 1));
  }
  for (int i = 1; i < n + m; i++) {
    sort(x[i].begin(), x[i].end());
    sort(y[i].begin(), y[i].end());
  }
  scanf("%d%d", &sx, &sy);
  scanf("%s", op);
  if (op[0] == 'S') {
    ix = 1;
  }
  if (op[0] == 'N') {
    ix = -1;
  }
  if (op[1] == 'W') {
    iy = -1;
  }
  if (op[1] == 'E') {
    iy = 1;
  }
  dx = ix, dy = iy, cx = sx, cy = sy;
  where_the_ray_go();
  while (1) {
    ray_pass_my_star();
    where_the_ray_go();
    if (where_is_my_star()) {
      break;
    }
  }
  printf("%lld", i_find_my_star);
  return 0;
}
