#include <bits/stdc++.h>
using namespace std;
int d, n, m;
int i, j;
vector<pair<int, int> > gas;
struct cmp {
  bool operator()(const pair<int, int> &p1, const pair<int, int> &p2) {
    return p1.second > p2.second;
  }
};
priority_queue<pair<int, int>, vector<pair<int, int> >, cmp> q;
int main() {
  scanf("%d%d%d", &d, &n, &m);
  gas.push_back(make_pair(0, 0));
  gas.push_back(make_pair(n, -1));
  for (i = 0; i < m; i++) {
    int x, p;
    scanf("%d%d", &x, &p);
    gas.push_back(make_pair(x, p));
    if (x + n < d) gas.push_back(make_pair(x + n, -1));
  }
  gas.push_back(make_pair(d, -1));
  sort(gas.begin(), gas.end());
  int sz = gas.size();
  long long ans = 0, pos = 0;
  q.push(gas[0]);
  for (i = 1; i < sz; i++) {
    int lim = gas[i].first - n;
    if (pos < lim) return puts("-1"), 0;
    while (q.top().first < lim) q.pop();
    ans += (long long)(gas[i].first - gas[i - 1].first) * q.top().second;
    if (gas[i].second != -1) {
      q.push(gas[i]);
      pos = gas[i].first;
    }
  }
  cout << ans << endl;
  return 0;
}
