#include<bits/stdc++.h>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e18
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const int inf = (int)1e9; 
 
 
 
using P = pair<int,int>;

ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
  if(b==0){
    return a;
  }
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}


template<typename T>
struct BIT{
    private:
    vector<T> array;
    int length;
    
    public:

    BIT(int _n=0) : array(_n+1),length(_n){}

    T sum(int i){
        T s=0;
        while(i>0){
            s+=array[i];
            i -= i&(-i);
        }
        return s;
    }

    T sum(int i,int j){
        T ret1 = sum(i-1);
        T ret2 = sum(j);
        return ret2-ret1;
    }

    void add(int i,T x){
        while(i<=length){
            array[i]+=x;
            i += i&(-i);
        }
    }
};

ll row[200010];
ll col[200010];

vector<ll> v[200010];

int main(void){
  ll h,w,m;
  cin>>h>>w>>m;
  for(int i=1;i<=h;i++)row[i] = w+1;
  for(int i=1;i<=w;i++)col[i] = h+1;
  ll ans = 0;
  for(int i=0;i<m;i++){
    ll x,y;
    cin>>x>>y;
    row[x] = min(row[x],y);
    col[y] = min(col[y],x);
  }
  ll Mw = row[1];
  ll Mh = col[1];
  for(ll i=1;i<Mh;i++){
    ans += row[i]-1;
    v[row[i]-1].push_back(i);
  }
  for(ll i=1;i<Mw;i++){
    ans += col[i]-1;
  }
  //cout<<ans<<endl;
  BIT<ll> bit = BIT<ll>(h+1);
  ll res = 0;
  for(ll i=1;i<=w;i++){
    if(i<Mw){
      bit.add(1,1LL);
      bit.add(col[i],-1LL);
    }
    //cout<<col[i]<<" ";
    for(int j=0;j<v[i].size();j++){
      ll t = bit.sum(v[i][j]);
      res += bit.sum(v[i][j]);
      //cout<<t<<" ";
    }
    ////cout<<endl;
  }
  cout<<ans-res<<endl;
  return 0;
}

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define REV(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001l
#define MOD 1000000007
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;
template<class T>
using M =vector<vector<T>>;

class BHydrate {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        int a,b,c,d;
        cin >> a >> b >> c >> d;

        if(c * d - b <= 0){
            cout << -1 << endl;
        }
        else{
            double t = (double)a / (c * d - b);
            cout << (int)ceil(t) << endl;
        }
	}
};

signed main() {
	BHydrate solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}
