#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 / 2;
const int inf = 1e9;
const int N = 5e5;
const double PI = acos(-1.0);
const int MOD = 1000000000 + 7;
multiset<pair<int, int> > second;
multiset<pair<int, int> >::iterator it;
long long res = 0;
pair<int, int> a[N];
int n, m, d;
void erase(int need) {
  while (need > 0) {
    it = second.begin();
    if (it->second <= need) {
      need -= it->second;
      res += 1LL * it->first * it->second;
      second.erase(it);
      continue;
    }
    res += 1LL * it->first * need;
    pair<int, int> tmp = make_pair(it->first, it->second);
    second.erase(it);
    second.insert(make_pair(tmp.first, tmp.second - need));
    need = 0;
  }
}
void add(int fir, int sec) {
  second.insert(make_pair(fir, sec));
  while (true) {
    it = second.end();
    --it;
    if (it->first > fir) {
      int val = it->second;
      second.erase(it);
      second.insert(make_pair(fir, val));
    } else
      break;
  }
}
int main() {
  ios ::sync_with_stdio(false);
  cin >> d >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  a[m++].first = d;
  sort(a, a + m);
  int cur = 0;
  res = 0;
  second.insert(make_pair(0, n));
  for (int i = 0; i < m; ++i) {
    int need = a[i].first - cur;
    if (need > n) {
      cout << "-1" << endl;
      return 0;
    }
    erase(need);
    add(a[i].second, need);
    cur = a[i].first;
  }
  cout << res << endl;
  return 0;
}
