#include <bits/stdc++.h>
using namespace std;
int d, tank, n;
long long int sol = 0;
const int limite = 1000000;
int i1 = 0;
int i2 = 0;
long long int precio[limite];
long long int cuanto[limite];
int main() {
  ios::sync_with_stdio(false);
  cin >> d >> tank >> n;
  vector<pair<long long int, long long int> > v(n);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  v.push_back(pair<long long int, long long int>(d, 0));
  sort(v.begin(), v.end());
  long long int posant = 0;
  cuanto[0] = tank;
  for (int i = 0; i < int(v.size()); i++) {
    long long int posact = v[i].first;
    long long int priceact = v[i].second;
    if (posant + tank < posact) {
      cout << -1 << endl;
      exit(0);
    }
    long long int dif = posact - posant;
    long long int difini = dif;
    while (dif) {
      if (cuanto[i1] <= dif) {
        sol += precio[i1] * cuanto[i1];
        dif -= cuanto[i1];
        i1++;
      } else {
        sol += precio[i1] * dif;
        cuanto[i1] -= dif;
        dif = 0;
      }
    }
    while (i1 <= i2 and priceact < precio[i2]) {
      difini += cuanto[i2];
      i2--;
    }
    i2++;
    precio[i2] = priceact;
    cuanto[i2] = difini;
    posant = posact;
  }
  cout << sol << endl;
}
