#include <bits/stdc++.h>
const int N = 205000;
using namespace std;
int n, m, d, a, b;
vector<pair<int, int> > v;
multiset<pair<int, int> > F;
multiset<pair<int, int> >::iterator it;
int cap;
long long ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> d >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  v.push_back(make_pair(0, 0));
  v.push_back(make_pair(d, 1e9));
  sort(v.begin(), v.end());
  cap = n;
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      int span = v[i].first - v[i - 1].first;
      if (span > n) {
        cout << -1 << endl;
        return 0;
      }
      while (span > 0) {
        it = F.begin();
        pair<int, int> p = (*it);
        F.erase(it);
        int can_spend = min(p.second, span);
        cap += can_spend;
        p.second -= can_spend;
        span -= can_spend;
        if (p.second) F.insert(p);
      }
    }
    while (true) {
      if (F.size() == 0) break;
      it = F.end();
      --it;
      pair<int, int> p = (*it);
      if (p.first > v[i].second || i == v.size() - 1) {
        F.erase(it);
        cap += p.second;
        ans -= 1ll * p.first * p.second;
      } else
        break;
    }
    if (cap > 0 && i + 1 < v.size()) {
      ans += 1ll * v[i].second * cap;
      F.insert(make_pair(v[i].second, cap));
      cap = 0;
    }
  }
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
