#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
struct event {
  int x, t, p;
  event(int _x = 0, int _t = 0, int _p = 0) {
    x = _x;
    t = _t;
    p = _p;
  }
  bool operator<(const event &a) const {
    if (a.x != x) return x < a.x;
    if (a.t != t) return t > a.t;
    return p < a.p;
  }
};
long long sol;
int d, n, sz;
multiset<int> s;
event a[maxn * 2];
int main(void) {
  ios::sync_with_stdio(false);
  cin >> d >> sz >> n;
  for (int i = 0; i < n; i++) {
    int x, p;
    cin >> x >> p;
    a[i * 2] = event(x, 1, p);
    a[i * 2 + 1] = event(x + sz, 0, p);
  }
  n *= 2;
  a[n] = event(0, 1, 0);
  a[n + 1] = event(sz, 0, 0);
  a[n + 2] = event(d, 0, 0);
  n += 3;
  sort(a, a + n);
  int prev = 0;
  for (int i = 0; i < n; i++) {
    if (a[i].x != prev && s.empty()) {
      cout << -1 << endl;
      return 0;
    }
    sol += (long long)(a[i].x - prev) * (*s.begin());
    if (a[i].x == d) break;
    if (a[i].t == 1) s.insert(a[i].p);
    if (a[i].t == 0) s.erase(s.find(a[i].p));
    prev = a[i].x;
  }
  cout << sol << endl;
  return 0;
}
