#include <bits/stdc++.h>
using namespace std;
char _;
const int maxN = 200 * 1000 + 5;
const int maxM = 5000 + 5;
const int mod = 1000 * 1000 * 1000 + 7;
const int base = 701;
const int SQ = 500;
const int maxL = 20;
pair<int, int> a[maxN];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int d, n, m;
  cin >> d >> n >> m;
  for (int i = 1; i < m + 1; i++) cin >> a[i].first >> a[i].second;
  sort(a + 1, a + m + 1);
  a[m + 1].first = d;
  a[m + 1].second = 0;
  m += 2;
  for (int i = 1; i < m; i++)
    if (a[i].first - a[i - 1].first > n) {
      cout << -1 << endl;
      return 0;
    }
  map<int, int> mp;
  long long ans = 0;
  int sum = n;
  mp[0] = n;
  for (int i = 1; i < m; i++) {
    vector<pair<int, int> > bad;
    int dis = a[i].first - a[i - 1].first;
    for (auto it = mp.begin(); it != mp.end(); it++) {
      if (dis >= it->second) {
        dis -= it->second;
        sum -= it->second;
        bad.push_back(*it);
      } else
        break;
    }
    for (auto it : bad) mp.erase(it.first);
    mp[mp.begin()->first] -= dis;
    sum -= dis;
    bad.clear();
    for (auto it = mp.rbegin(); it != mp.rend(); it++)
      if (it->first > a[i].second) {
        sum -= it->second;
        ans -= (1LL) * it->first * it->second;
        bad.push_back(*it);
      } else
        break;
    for (auto it : bad) mp.erase(it.first);
    mp[a[i].second] += n - sum;
    ans += (1LL) * (n - sum) * a[i].second;
    sum = n;
  }
  cout << ans << endl;
  return 0;
}
