#include <bits/stdc++.h>
using namespace std;
void Rd(int &x) {
  static char c;
  x = 0;
  while ((c = getchar()) < 48)
    ;
  do x = (x << 3) + (x << 1) + (c ^ 48);
  while ((c = getchar()) > 47);
}
int d, n, m;
struct Node {
  int x, p;
  bool operator<(const Node &_) const { return x < _.x; }
} D[200004];
int Val[200004], Num[200004];
int main() {
  Rd(d), Rd(n), Rd(m);
  for (int i = (0), i_end_ = (m); i < i_end_; ++i) Rd(D[i].x), Rd(D[i].p);
  sort(D, D + m);
  D[m++] = (Node){d, 0};
  int Now = 0, All = n, l = 0, r = 0;
  long long Ans = 0;
  Num[0] = n;
  for (int i = (0), i_end_ = (m); i < i_end_; ++i) {
    int X = D[i].x;
    if (X - Now > n) {
      puts("-1");
      return 0;
    }
    while (Now != X) {
      int f = min(Num[l], X - Now);
      Ans += (long long)f * Val[l];
      Num[l] -= f, All -= f, Now += f;
      if (!Num[l]) l++;
    }
    while (l <= r && Val[r] > D[i].p) All -= Num[r--];
    Num[++r] = n - All, Val[r] = D[i].p;
    All = n;
  }
  printf("%I64d\n", Ans);
  return 0;
}
