#include <bits/stdc++.h>
using namespace std;
struct QWE {
  int cord, val;
  bool operator<(const QWE& other) const { return (val > other.val); }
};
QWE GetQWE(int cord, int val) {
  QWE ret;
  ret.cord = cord;
  ret.val = val;
  return ret;
}
priority_queue<QWE> pq;
int d, n, m;
int res[200002];
pair<int, int> info[200002];
int main() {
  scanf("%d %d %d", &d, &n, &m);
  info[0] = make_pair(0, 0);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &info[i].first);
    scanf("%d", &info[i].second);
    if (info[i].first > d) {
      i--;
      m--;
      continue;
    }
  }
  sort(info + 1, info + m + 1);
  pq.push(GetQWE(0, 0));
  long long allval = 0;
  info[++m] = make_pair(d, 0);
  for (int i = 1; i <= m; i++) {
    int curc = info[i - 1].first;
    while (!pq.empty() && curc != info[i].first) {
      QWE top = pq.top();
      int maxget = n - (curc - top.cord);
      if (maxget <= 0) {
        pq.pop();
        continue;
      }
      int old = curc;
      curc = min(info[i].first, curc + maxget);
      allval += (long long)(curc - old) * (long long)top.val;
    }
    if (curc != info[i].first) {
      printf("-1\n");
      return 0;
    }
    pq.push(GetQWE(info[i].first, info[i].second));
  }
  printf("%lld\n", allval);
}
