#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int d, n, m;
int go[N];
pair<int, int> a[N];
int main() {
  scanf("%d %d %d", &d, &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
  }
  a[++m] = pair<int, int>(0, 0);
  a[++m] = pair<int, int>(d, -1);
  sort(a + 1, a + m + 1);
  vector<int> v;
  v.push_back(m + 1);
  a[m + 1] = pair<int, int>(0, -1e9);
  for (int i = m; i >= 1; i--) {
    while (a[v.back()].second >= a[i].second) v.pop_back();
    go[i] = min(a[v.back()].first, a[i].first + n);
    v.push_back(i);
  }
  int cur = 0;
  long long ans = 0;
  for (int i = 1; i < m; i++) {
    if (a[i + 1].first - a[i].first > n) {
      puts("-1");
      return 0;
    }
    int add = max(0, go[i] - a[i].first - cur);
    ans += (long long)add * a[i].second;
    cur += add;
    cur -= a[i + 1].first - a[i].first;
  }
  printf("%lld\n", ans);
  return 0;
}
