#include <bits/stdc++.h>
using namespace std;
struct query_t {
  long long x, p;
  bool in;
};
bool operator<(query_t a, query_t b) { return a.x < b.x; }
int main() {
  long long d, n;
  int m;
  cin >> d >> n >> m;
  vector<query_t> qs(2 * m + 3);
  for (int i = 0; (i) < (m); ++(i)) {
    long long x, p;
    cin >> x >> p;
    qs[2 * i] = {x, p, true};
    qs[2 * i + 1] = {x + n, p, false};
  }
  qs[2 * m] = {0, 0, true};
  qs[2 * m + 1] = {n, 0, false};
  qs[2 * m + 2] = {d, 0, true};
  sort(qs.begin(), qs.end());
  long long ans = 0;
  long long last = 0;
  multiset<long long> p;
  for (query_t q : qs) {
    if (last < q.x) {
      if (p.empty()) {
        ans = -1;
        break;
      }
      ans += (q.x - last) * *p.begin();
      last = q.x;
    }
    if (q.in) {
      p.insert(q.p);
    } else {
      auto it = p.find(q.p);
      p.erase(it);
    }
  }
  cout << ans << endl;
  return 0;
}
