#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s;
set<pair<int, int> >::iterator it;
int n, m, d;
int x[200500], p[200500];
int pp[200500];
long long ans = 0;
bool cmp(int i, int j) { return p[i] < p[j]; }
int main() {
  scanf("%d%d%d", &d, &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d%d", &x[i], &p[i]), pp[i] = i;
  if (n >= d) {
    printf("0");
    return 0;
  }
  sort(pp + 1, pp + 1 + m, cmp);
  s.insert(make_pair(d, n));
  for (int i = 1; i <= m; i++) {
    if (s.empty()) break;
    int pos = x[pp[i]];
    int cent = p[pp[i]];
    it = s.lower_bound(make_pair(pos, pos));
    if (it == s.end()) continue;
    int l = it->second;
    int r = it->first;
    int nl = max(pos, l);
    int nr = min(pos + n, r);
    if (nl >= nr) continue;
    s.erase(it);
    ans += 1ll * (nr - nl) * cent;
    if (nl > l) s.insert(make_pair(nl, l));
    if (nr < r) s.insert(make_pair(r, nr));
  }
  printf("%I64d", s.empty() ? ans : -1ll);
  return 0;
}
