#include <bits/stdc++.h>
using namespace std;
deque<int> RMQ;
inline void insert(int i) {
  while (!RMQ.empty() && RMQ.front() > i) {
    RMQ.pop_front();
  }
  RMQ.push_front(i);
}
inline int mini() { return RMQ.back(); }
inline void del(int i) {
  if (RMQ.back() == i) RMQ.pop_back();
}
struct eventt {
  int x, p;
  bool type;
  friend bool operator<(const eventt& e1, const eventt& e2) {
    return e1.x < e2.x;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int d, n, m;
  cin >> d >> n >> m;
  vector<eventt> EV(2 * m + 2);
  EV[0] = {n, 0, false};
  EV[1] = {d, 0, true};
  for (int i = 0; i < (m); i++) {
    int x, p;
    cin >> x >> p;
    EV[2 * i + 2] = {x, p, true};
    EV[2 * i + 3] = {x + n, p, false};
  }
  sort(EV.begin(), EV.end());
  int lastEventFilled = 0;
  insert(0);
  long long total = 0;
  for (int i = 0; i < EV.size();) {
    int x = EV[i].x;
    if (RMQ.empty()) {
      cout << -1;
      return 0;
    }
    total += mini() * (long long)(x - lastEventFilled);
    if (x == d) break;
    while (i < EV.size() && EV[i].x == x) {
      if (EV[i].type) {
        insert(EV[i].p);
      } else {
        del(EV[i].p);
      }
      i++;
    }
    lastEventFilled = x;
  }
  cout << total;
}
