#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
struct station {
  ll p, remain, idx;
  bool operator<(const station& s) const { return p > s.p; }
};
template <typename T>
class fenwick_tree {
 public:
  fenwick_tree(int n_) : n(n_), dat(n, 0) {}
  void add(int i, T value) {
    for (; i < n; i |= i + 1) {
      dat[i] += value;
    }
  }
  T sum(int i) const {
    T res = 0;
    for (; i >= 0; i = (i & (i + 1)) - 1) {
      res += dat[i];
    }
    return res;
  }
  T sum(int l, int r) const { return sum(r - 1) - sum(l - 1); }

 private:
  const int n;
  std::vector<T> dat;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll d, n, m;
  cin >> d >> n >> m;
  vector<pll> gas(m);
  vector<int> ps(m);
  ps.push_back(0);
  ps.push_back(d);
  for (int i = 0; i < m; ++i) {
    cin >> gas[i].first >> gas[i].second;
    ps[i] = gas[i].first;
  }
  sort(gas.begin(), gas.end());
  sort(ps.begin(), ps.end());
  priority_queue<station> que;
  ll ans = 0, fuel = n;
  int last_use = -1;
  fenwick_tree<ll> offset(m + 1);
  for (int i = 0; i < m + 1; ++i) {
    fuel -= ps[i + 1] - ps[i];
    while (fuel < 0 && !que.empty()) {
      auto stat = que.top();
      que.pop();
      if (stat.idx < last_use) continue;
      if (stat.remain <= offset.sum(0, stat.idx + 1)) continue;
      const ll can_use = stat.remain - offset.sum(0, stat.idx + 1);
      ll use = min(-fuel, can_use);
      ans += use * stat.p;
      fuel += use;
      offset.add(stat.idx, use);
      last_use = stat.idx;
      if (can_use != use) {
        que.push(stat);
      }
    }
    if (fuel < 0) {
      ans = -1;
      break;
    }
    if (i != m) {
      que.push(station{gas[i].second, n - fuel + offset.sum(0, i), i});
    }
  }
  cout << ans << endl;
}
