#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
pair<int, int> a[N];
multiset<pair<int, int>> s;
int main() {
  int n, d, m, i;
  scanf("%d%d%d", &d, &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &a[i].first, &a[i].second);
  }
  m++;
  a[m] = {d, 0};
  sort(a + 1, a + 1 + m);
  int curpos = n;
  long long ans = 0;
  i = 1;
  while (i <= m) {
    while (i <= m && a[i].first <= curpos) {
      s.insert({a[i].second, a[i].first});
      i++;
    }
    while (!s.empty() && s.begin()->second + n <= curpos) {
      s.erase(s.begin());
    }
    if (i > m) break;
    if (s.empty()) {
      cout << -1;
      return 0;
    }
    auto it = *s.begin();
    ans += 1ll * it.first * min(a[i].first - curpos, it.second + n - curpos);
    curpos = min(a[i].first, it.second + n);
  }
  cout << ans;
}
