#include <bits/stdc++.h>
using namespace std;
struct aaa {
  long long x, w;
} a[500010];
long long D, mx, m, ans, la, f[500010], nt[500010];
bool cmp(aaa a, aaa b) { return a.x < b.x; }
long long lowbit(long long x) { return x & (-x); }
void ins(long long x, long long w) {
  long long i;
  for (i = x; i <= m; i += lowbit(i)) f[i] = min(f[i], w);
}
long long query(long long x) {
  long long i, xlh = 1e17;
  for (i = x; i; i -= lowbit(i)) xlh = min(xlh, f[i]);
  return xlh;
}
int main() {
  long long i, l, r, mid, mn;
  scanf("%lld%lld%lld", &D, &mx, &m);
  for (i = 1; i <= m; i++) scanf("%lld%lld", &a[i].x, &a[i].w);
  sort(a + 1, a + m + 1, cmp);
  a[++m].x = D;
  memset(f, 44, sizeof(f));
  for (i = 1; i <= m; i++)
    if (a[i].x - a[i - 1].x > mx) return puts("-1"), 0;
  la = mx - a[1].x;
  for (i = m; i; i--) {
    l = i + 1;
    r = m;
    mn = m + 1;
    while (l <= r) {
      mid = (l + r) / 2;
      if (query(mid) < a[i].w) {
        mn = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    nt[i] = mn;
    ins(i, a[i].w);
  }
  i = 1;
  while (i < m) {
    mn = nt[i];
    if (mn <= m && a[mn].x - a[i].x <= mx) {
      ans += a[i].w * max(a[mn].x - a[i].x - la, 0ll);
      la = max(0ll, la - (a[mn].x - a[i].x));
      i = nt[i];
    } else {
      ans += a[i].w * (mx - la);
      la = mx - a[i + 1].x + a[i].x;
      i++;
    }
  }
  printf("%lld", ans);
}
