#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, m;
  cin >> n >> m;
  long long xc, yc;
  cin >> xc >> yc;
  long long k;
  cin >> k;
  vector<pair<long long, long long>> vect(k);
  for (int i = 0; i < k; ++i) {
    cin >> vect[i].first >> vect[i].second;
  }
  long long ans = 0;
  for (int i = 0; i < k; ++i) {
    long long l = 0;
    long long r = 1e9;
    long long mid = (l + r) / 2;
    while (l <= r) {
      long long newrow = xc + vect[i].first * mid;
      long long newcol = yc + vect[i].second * mid;
      if (newrow > 0 && newrow <= n && newcol > 0 && newcol <= m) {
        if (newrow + vect[i].first <= 0 || newrow + vect[i].first > n ||
            newcol + vect[i].second <= 0 || newcol + vect[i].second > m) {
          break;
        }
        l = mid + 1;
      } else {
        r = mid - 1;
      }
      mid = (l + r) / 2;
    }
    ans += mid;
    xc += vect[i].first * mid;
    yc += vect[i].second * mid;
  }
  cout << ans << '\n';
  return 0;
}
