#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
multiset<pair<int, int> > mst;
pair<int, int> a[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int d, full, n;
  cin >> d >> full >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a + 1, a + n + 1);
  a[0].first = 0;
  a[0].second = 0;
  a[n + 1].first = d;
  a[n + 1].second = 0;
  int j = 0;
  for (int i = 0; i <= n; i++) {
    mst.insert(make_pair(a[i].second, a[i].first));
    long long pos = a[i].first;
    long long nxt = a[i + 1].first;
    while (pos < nxt) {
      while (j <= i && a[j].first + full <= pos) {
        mst.erase(make_pair(a[j].second, a[j].first));
        j++;
      }
      if (mst.size() == 0) {
        cout << -1;
        exit(0);
      }
      long long far = mst.begin()->second + full;
      long long take = 0;
      if (far >= nxt) {
        ans += (nxt - pos) * (mst.begin()->first);
        pos = nxt;
      } else {
        ans += (far - pos) * (mst.begin()->first);
        pos = far;
      }
    }
  }
  cout << ans;
  return 0;
}
