#include <bits/stdc++.h>
using namespace std;
long long N, D, M, l[200100], r[200100];
pair<long long, long long> a[200100];
long long v[200100];
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> D >> N >> M;
  for (int i = 1; i <= M; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  a[M + 1].first = D;
  sort(a, a + M + 2);
  for (int i = 0; i <= M; ++i) {
    if (a[i + 1].first - a[i].first > N) {
      cout << -1;
      return 0;
    }
  }
  long long ret = 0;
  for (int i = 1; i <= M; ++i) {
    l[i] = 0;
    r[i] = M + 1;
  }
  int c = 0;
  v[++c] = 0;
  for (int i = 1; i <= M; ++i) {
    while (a[i].second < a[v[c]].second) {
      --c;
    }
    l[i] = v[c];
    v[++c] = i;
  }
  c = 0;
  v[++c] = M + 1;
  for (int i = M; i >= 1; --i) {
    while (a[i].second <= a[v[c]].second) {
      --c;
    }
    r[i] = v[c];
    v[++c] = i;
  }
  for (int i = 1; i <= M; ++i) {
    long long L = max(a[l[i]].first + N, a[i].first);
    long long R = min(a[r[i]].first, a[i].first + N);
    if (R > L) {
      ret += a[i].second * (R - L);
    }
  }
  cout << ret;
  return 0;
}
