#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> ar[1000010];
priority_queue<pair<long long, long long> > pq;
void solve() {
  int d, n, m;
  scanf("%d", &d);
  ;
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  for (int i = 0; i < m; i++) {
    scanf("%lld", &ar[i].first);
    ;
    scanf("%lld", &ar[i].second);
    ;
  }
  sort(ar, ar + m);
  ar[m].first = d;
  ar[m].second = 1000000009;
  pair<long long, long long> now;
  pq.push(make_pair(0, n));
  long long last = 0;
  long long ans = 0;
  for (int i = 0; i <= m; i++) {
    while (!pq.empty()) {
      now = pq.top();
      if (now.second > ar[i].first) break;
      if (now.second > last) {
        ans = ans - (now.second - last) * now.first;
        last = now.second;
      }
      pq.pop();
    }
    if (last < ar[i].first) {
      if (pq.empty()) {
        cout << "-1\n";
        return;
      }
      now = pq.top();
      ans = ans - (ar[i].first - last) * now.first;
      last = ar[i].first;
    }
    pq.push(make_pair(-ar[i].second, ar[i].first + n));
  }
  cout << ans << endl;
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
}
