#include <bits/stdc++.h>
using namespace std;
int compare(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
double readTime() { return double(clock()) / CLOCKS_PER_SEC; }
char *ipos, *opos, InpFile[10000000], OutFile[1000000], DIP[20];
char *inputEnd;
inline bool eof() {
  while (ipos < inputEnd && *ipos <= 32) ipos++;
  return ipos >= inputEnd;
}
inline char nc() {
  while (*ipos <= 32) ++ipos;
  return *ipos++;
}
inline int ns(char *arr) {
  while (*ipos <= 32) ++ipos;
  int count = 0;
  char c;
  while (true) {
    c = *ipos++;
    if (c == '\n')
      return count;
    else {
      arr[count++] = c;
    }
  }
}
inline int ni(int flag = 0) {
  while (*ipos <= 32) ++ipos;
  if (flag) return (*ipos++ - '0');
  int x = 0, neg = 0;
  char c;
  while (true) {
    c = *ipos++;
    if (c == '-')
      neg = 1;
    else {
      if (c <= 32) return neg ? -x : x;
      x = (x << 1) + (x << 3) + c - '0';
    }
  }
}
inline long long nll() {
  while (*ipos <= 32) ++ipos;
  long long x = 0, neg = 0;
  char c;
  while (true) {
    c = *ipos++;
    if (c == '-')
      neg = 1;
    else {
      if (c <= 32) return neg ? -x : x;
      x = (x << 1) + (x << 3) + c - '0';
    }
  }
}
inline void pi(int x, int flag = 1) {
  int y, dig = 0;
  if (x < 0) {
    *opos++ = '-';
    x = -x;
  };
  while (x || !dig) {
    y = x / 10;
    DIP[dig++] = x - ((y << 3) + (y << 1)) + '0';
    x = y;
  }
  while (dig--) *opos++ = DIP[dig];
  *opos++ = flag ? '\n' : ' ';
}
inline void pll(long long x, int flag = 1) {
  long long y, dig = 0;
  if (x < 0) {
    *opos++ = '-';
    x = -x;
  };
  while (x || !dig) {
    y = x / 10;
    DIP[dig++] = x - ((y << 3) + (y << 1)) + '0';
    x = y;
  }
  while (dig--) *opos++ = DIP[dig];
  *opos++ = flag ? '\n' : ' ';
}
inline void ps(string str, int flag = 1) {
  int len = str.length();
  for (int i = 0; i < len; i++) *opos++ = str[i];
  *opos++ = flag ? '\n' : ' ';
}
inline void pc(char c, int flag = 1) {
  *opos++ = c;
  *opos++ = flag ? '\n' : ' ';
}
inline void pws(int flag = 1) { *opos++ = flag ? '\n' : ' '; }
inline void InitFASTIO() {
  ipos = InpFile;
  opos = OutFile;
  inputEnd = InpFile + fread(InpFile, 1, 10000000, stdin);
}
inline void FlushFASTIO() { fwrite(OutFile, opos - OutFile, 1, stdout); }
int main(void) {
  int n, m, k;
  int i, x, y;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &x);
  scanf("%d", &y);
  scanf("%d", &k);
  int arrx[k], arry[k];
  for ((i) = (0); (i) < (k); (i)++) {
    scanf("%d", &arrx[i]);
    scanf("%d", &arry[i]);
  }
  long long count = 0;
  long long c1, c2;
  for ((i) = (0); (i) < (k); (i)++) {
    c1 = c2 = (long long)1e18;
    if (arrx[i] > 0) {
      c1 = (long long)(n * 1.0 - x * 1.0) / (arrx[i] * 1.0);
    } else if (arrx[i] < 0) {
      c1 = -1 * (long long)(x * 1.0 - 1.0) / (arrx[i] * 1.0);
    }
    if (arry[i] > 0) {
      c2 = (long long)(m * 1.0 - y * 1.0) / (arry[i] * 1.0);
    } else if (arry[i] < 0) {
      c2 = -1 * (long long)(y * 1.0 - 1.0) / (arry[i] * 1.0);
    }
    c1 = ((c1) < (c2) ? (c1) : (c2));
    count += c1;
    x = x + arrx[i] * c1;
    y = y + arry[i] * c1;
  }
  cout << count << "\n";
  return 0;
}
