#include <bits/stdc++.h>
const int MOD = 1000000007;
const int M = 200001;
using namespace std;
struct Deque {
  int front, back;
  long long cost;
  pair<long long, long long> el[M];
  bool empty() { return back == front; }
  pair<long long, long long> last() { return el[back - 1]; }
  pair<long long, long long> first() { return el[front]; }
  void pop_front() {
    cost += el[front].first * el[front].second;
    front++;
  }
  void pop_back() { back--; }
  void push_back(pair<long long, long long> x) { el[back++] = x; }
  void push_front(pair<long long, long long> x) {
    cost -= x.first * x.second;
    el[--front] = x;
  }
} dq;
long long d, n, m;
pair<long long, long long> x[M];
int main() {
  scanf("%I64d%I64d%I64d", &d, &n, &m);
  for (int i = 0; i < m; i++) scanf("%I64d%I64d", &x[i].first, &x[i].second);
  sort(x, x + m);
  x[m++] = make_pair(d, 0);
  for (int i = m - 1; i >= 1; i--) x[i].first -= x[i - 1].first;
  dq.push_back(make_pair(n, 0));
  for (int i = 0; i < m; i++) {
    if (x[i].first > n) {
      printf("-1\n");
      return 0;
    }
    long long len = 0, lp = 0;
    while (!dq.empty() && len < x[i].first) {
      len += dq.first().first;
      lp = dq.first().second;
      dq.pop_front();
    }
    if (len < x[i].first) {
      printf("-1\n");
      return 0;
    }
    if (len > x[i].first) dq.push_front(make_pair(len - x[i].first, lp));
    while (!dq.empty() && dq.last().second >= x[i].second) {
      x[i].first += dq.last().first;
      dq.pop_back();
    }
    dq.push_back(make_pair(x[i].first, x[i].second));
  }
  printf("%I64d\n", dq.cost);
  return 0;
}
