#include <bits/stdc++.h>
using namespace std;
long long d, n, m, ans = 0, curx, curp;
struct Station {
  long long price;
  long long pos;
  long long idx;
  Station(long long price, long long pos, long long idx)
      : price(price), pos(pos), idx(idx) {}
  bool operator<(const Station& s) const {
    if (price == s.price) {
      return idx < s.idx;
    }
    return price < s.price;
  }
};
struct PosCompare {
  bool operator()(const Station& a, const Station& b) { return a.pos < b.pos; }
} PosCompare;
bool FillMinGas(vector<long long>& mingas, vector<Station>& gas) {
  if (max(gas[0].pos, d - gas[m - 1].pos) > n) return false;
  for (long i = 1; i < m; ++i) {
    if (gas[i].pos - gas[i - 1].pos > n) return false;
  }
  long long fs = m - 1;
  for (long i = 0; i < m - 1; ++i) {
    if (gas[i + 1].pos > n) {
      fs = i;
      break;
    }
  }
  for (long i = 0; i < fs; ++i) mingas[i] = 0;
  if (fs == m - 1) {
    mingas[fs] = d - n;
    return true;
  }
  mingas[fs] = gas[fs + 1].pos - n;
  for (long i = fs + 1; i < m - 1; ++i) mingas[i] = gas[i + 1].pos - gas[i].pos;
  mingas[m - 1] = d - gas[m - 1].pos;
  return true;
}
void FillCheaper(vector<Station>& cheaper, vector<Station>& gas) {
  long long lir = m - 1;
  set<Station> ps;
  for (long i = m - 1; i >= 0; --i) {
    while (gas[lir].pos - n >= gas[i].pos) {
      ps.erase(gas[lir]);
      lir--;
    }
    for (auto it = ps.upper_bound(gas[i]); it != ps.end();) {
      cheaper[it->idx] = gas[i];
      it = ps.erase(it);
    }
    ps.insert(gas[i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> d >> n >> m;
  if (n >= d) {
    cout << 0 << endl;
    return 0;
  }
  vector<Station> gas;
  for (long i = 0; i < m; ++i) {
    cin >> curx >> curp;
    gas.push_back(Station(curp, curx, -1));
  }
  sort(gas.begin(), gas.end(), PosCompare);
  for (long i = 0; i < m; ++i) gas[i].idx = i;
  vector<long long> mingas(m, 0);
  if (!FillMinGas(mingas, gas)) {
    cout << -1 << endl;
    return 0;
  }
  vector<Station> cheaper(m, Station(-1, -1, -1));
  FillCheaper(cheaper, gas);
  priority_queue<Station, vector<Station>> pq;
  for (long i = 0; i < m; ++i) pq.push(gas[i]);
  while (!pq.empty()) {
    Station top = pq.top();
    pq.pop();
    Station chp = cheaper[top.idx];
    if (chp.idx == -1) continue;
    long long cmg = min(n, chp.pos);
    if (mingas[chp.idx] != cmg) {
      long long transfering = min(cmg - mingas[chp.idx], mingas[top.idx]);
      mingas[top.idx] -= transfering;
      mingas[chp.idx] += transfering;
    }
  }
  for (long i = 0; i < m; ++i) ans += mingas[i] * gas[i].price;
  cout << ans << endl;
}
