#include <bits/stdc++.h>
using namespace std;
struct ty {
  int d, v, w;
} tmp, s[400100];
bool operator<(ty c1, ty c2) { return c1.d < c2.d; }
multiset<int> A;
int n, d, m;
long long ans;
int main() {
  int i, j, head = 1;
  scanf("%d%d%d", &d, &n, &m);
  for (i = 1; i <= m; ++i) {
    scanf("%d%d", &s[i].d, &s[i].v);
    s[i].w = 1;
    s[m + i].v = s[i].v;
    s[m + i].d = s[i].d + n;
    s[m + i].w = 0;
  }
  m = m * 2;
  ++m;
  s[m].d = 0;
  s[m].v = 0;
  s[m].w = 1;
  ++m;
  s[m].d = n;
  s[m].v = 0;
  s[m].w = 0;
  ++m;
  s[m].d = d;
  sort(s + 1, s + m + 1);
  A.insert(0);
  for (i = 2; s[i].d <= d; ++i) {
    while (s[head].d < s[i].d - n && head < i) {
      if (s[head].w) A.erase(A.find(s[head].v));
      ++head;
    }
    if (A.size() == 0) {
      puts("-1");
      return 0;
    }
    ans += ((long long)s[i].d - s[i - 1].d) * (*A.begin());
    if (s[i].w) A.insert(s[i].v);
    if (s[i].d == d) break;
  }
  printf("%I64d\n", ans);
  return 0;
}
