#include <bits/stdc++.h>
using namespace std;
long long ans;
const int Mmax = 2e5 + 10;
int d, n, m, i;
pair<int, int> a[Mmax];
set<int> second;
int main() {
  scanf("%d %d %d", &d, &n, &m);
  for (i = 1; i <= m; ++i) scanf("%d %d", &a[i].second, &a[i].first);
  sort(a + 1, a + m + 1);
  second.insert(0);
  second.insert(d);
  set<int>::iterator l, r;
  for (i = 1; i <= m; ++i) {
    swap(a[i].first, a[i].second);
    set<int>::iterator l, r;
    l = second.lower_bound(a[i].first);
    l--;
    r = second.lower_bound(a[i].first);
    if ((*l) + n >= (*r)) continue;
    int stop = (*l) + n;
    ans +=
        1LL * (min(a[i].first + n, (*r)) - max(a[i].first, stop)) * a[i].second;
    second.insert(a[i].first);
  }
  l = second.begin();
  r = second.begin();
  r++;
  while (r != second.end()) {
    if ((*l) + n < (*r)) {
      printf("-1\n");
      return 0;
    }
    l++;
    r++;
  }
  printf("%I64d\n", ans);
  return 0;
}
