#include <bits/stdc++.h>
using namespace std;
const int N = 202020;
int d, n, m, tot;
deque<pair<int, int> > q;
long long ans;
pair<int, int> a[N];
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  cin >> d >> n >> m;
  for (int i = (1); i < (m + 1); i++) cin >> a[i].first >> a[i].second;
  sort(a + 1, a + 1 + m);
  q.push_back(make_pair(0, n));
  a[++m] = make_pair(d, 0);
  for (int i = (1); i < (m + 1); i++) {
    int t = a[i].first - a[i - 1].first;
    if (t > n) {
      cout << -1 << "\n";
      return 0;
    }
    tot = t;
    while ((int)q.size() && q.front().second <= t) {
      ans += q.front().first * 1ll * q.front().second;
      t -= q.front().second;
      q.pop_front();
    }
    q.front().second -= t;
    ans += q.front().first * 1ll * t;
    while ((int)q.size() && q.back().first > a[i].second)
      tot += q.back().second, q.pop_back();
    q.push_back(make_pair(a[i].second, tot));
  }
  cout << ans << "\n";
  return 0;
}
