#include <bits/stdc++.h>
using namespace std;
struct aa {
  int x;
  long long y;
} a[1000005];
int comp(aa p, aa q) { return p.x < q.x; }
stack<int> s;
int Next[1000005];
int main(void) {
  int d, m, n;
  while (scanf("%d%d%d", &d, &m, &n) == 3) {
    for (int i = 1; i <= n; i++) scanf("%lld%d", &a[i].x, &a[i].y);
    while (!s.empty()) s.pop();
    sort(a + 1, a + n + 1, comp);
    memset(Next, -1, sizeof(Next));
    for (int i = n; i > 0; i--) {
      if (i == n) {
        s.push(i);
      } else {
        while (!s.empty()) {
          int temp = s.top();
          if (a[temp].y < a[i].y) {
            Next[i] = temp;
            s.push(i);
            break;
          } else
            s.pop();
        }
        if (s.empty()) s.push(i);
      }
    }
    int now = m;
    long long cost = 0;
    int ok = 1;
    for (int i = 1; i <= n; i++) {
      if (now >= d) break;
      if (now < a[i].x) break;
      if (Next[i] != -1 && now >= a[Next[i]].x) continue;
      if (Next[i] == -1) {
        cost += (long long)min(d - now, m - (now - a[i].x)) * a[i].y;
        now = min(d, m + a[i].x);
      } else {
        cost +=
            (long long)min((a[Next[i]].x - now), m - (now - a[i].x)) * a[i].y;
        now = min(a[Next[i]].x, m + a[i].x);
      }
    }
    if (!ok || now < d)
      printf("-1\n");
    else
      printf("%lld\n", cost);
  }
  return 0;
}
