#include <bits/stdc++.h>
using namespace std;
int z() {
  int z;
  scanf("%d", &z);
  return z;
}
const int M = 2e5 + 5;
int d, n, m;
struct STC {
  int x, p;
} p[M];
bool cmp(STC a, STC b) { return a.x < b.x; }
set<pair<int, int> > S;
void work() {
  sort(p + 1, p + m + 1, cmp);
  S.insert(make_pair(0, n));
  int sum = n;
  long long ans = 0;
  for (int i = 1; i <= m + 1; i++) {
    int D = p[i].x;
    if (i > m) D = d;
    D -= p[i - 1].x;
    while (D) {
      if (S.empty()) {
        puts("-1");
        return;
      }
      auto u = *S.begin();
      S.erase(S.find(u));
      int use = min(D, u.second);
      ans += 1ll * use * u.first;
      if (use < u.second) {
        S.insert(make_pair(u.first, u.second - use));
      }
      D -= use;
      sum -= use;
    }
    if (i <= m) {
      sum += n;
      S.insert(make_pair(p[i].p, n));
      while (sum > n) {
        auto u = *S.rbegin();
        S.erase(S.find(u));
        int drop = min(u.second, sum - n);
        if (drop < u.second) {
          S.insert(make_pair(u.first, u.second - drop));
        }
        sum -= drop;
      }
    }
  }
  printf("%I64d\n", ans);
}
int main() {
  d = z(), n = z(), m = z();
  for (int i = 1; i <= m; i++) p[i].x = z(), p[i].p = z();
  work();
}
