#include <bits/stdc++.h>
using namespace std;
void imp() {
  cout << -1 << endl;
  exit(0);
}
int d, n, m;
int first[200005], p[200005];
int main() {
  cin >> d >> n >> m;
  for (int i = (int)(0); i < (int)(m); ++i) scanf("%d%d", first + i, p + i);
  vector<pair<int, int> > sweep;
  for (int i = (int)(0); i < (int)(m); ++i)
    sweep.push_back({first[i], p[i]}), sweep.push_back({first[i] + n, -p[i]});
  sweep.push_back({d, 0});
  sort(sweep.begin(), sweep.end());
  int pos = 0, can = n;
  multiset<long long> ref;
  long long R = 0;
  for (auto t : sweep) {
    int first = t.first, second = t.second;
    if (can + pos >= first)
      can -= first - pos, pos = first;
    else
      pos += can, can = 0;
    if (first != pos) {
      if (ref.empty()) imp();
      R += (first - pos) * *ref.begin();
      pos = first;
    }
    if (second == 0) break;
    if (second > 0) ref.insert(second);
    if (second < 0) ref.erase(ref.find(-second));
  }
  cout << R << endl;
  return 0;
}
