#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5;
struct node {
  long long x, p;
} st[maxn];
long long L[maxn], P[maxn];
long long ans;
long long D, n, m, i, j, x, y, bl;
bool cmp(node a, node b) { return a.x < b.x; }
bool solve() {
  sort(st + 1, st + m + 1, cmp);
  L[1] = n;
  P[1] = 0;
  long long l = 1, r = 1;
  long long i, bl = 1, p = 0;
  for (i = 1; i <= m; i++) {
    if (st[i].x - p > n) return 0;
    long long x = st[i].x - p;
    while (p < st[i].x) {
      long long d = st[i].x - p;
      if (l > r) {
        return 0;
      }
      if (L[l] > d) {
        ans += d * P[l];
        p += d;
        L[l] -= d;
      } else {
        ans += L[l] * P[l];
        p += L[l];
        l++;
      }
    }
    if (!bl) break;
    while (l <= r && P[r] >= st[i].p) {
      x += L[r];
      r--;
    }
    r++;
    P[r] = st[i].p;
    L[r] = x;
  }
  if (D - p > n) return 0;
  while (p < D) {
    long long d = D - p;
    if (l > r) {
      return 0;
    }
    if (L[l] > d) {
      ans += d * P[l];
      p += d;
      L[l] -= d;
    } else {
      ans += L[l] * P[l];
      p += L[l];
      l++;
    }
  }
  return 1;
}
int main() {
  scanf("%lld%lld%lld", &D, &n, &m);
  for (i = 1; i <= m; i++) scanf("%lld%lld", &st[i].x, &st[i].p);
  bl = solve();
  if (bl)
    printf("%lld\n", ans);
  else
    printf("-1");
  return 0;
}
