#include <bits/stdc++.h>
using namespace std;
int main() {
  int goal, n, stations;
  scanf("%i%i%i", &goal, &n, &stations);
  vector<pair<int, int> > points;
  points.push_back(make_pair(n, -1));
  points.push_back(make_pair(goal, 2000000000));
  for (auto e = 0; e < stations; e++) {
    int a, b;
    scanf("%i%i", &a, &b);
    points.push_back(make_pair(a, b));
    points.push_back(make_pair(a + n, -b - 1));
  }
  stable_sort(points.begin(), points.end());
  multiset<int> sw;
  auto prev = make_pair(0, 0);
  sw.insert(0);
  auto acc = 0LL;
  for (auto e : points) {
    if (sw.empty()) {
      if (e.first != prev.first) {
        acc = -1;
        break;
      }
    } else {
      acc += ((long long)e.first - prev.first) * (*sw.begin());
    }
    if (e.first == goal) {
      break;
    }
    if (e.second < 0) {
      sw.erase(sw.find(-e.second - 1));
    } else {
      sw.insert(e.second);
    }
    prev = e;
  }
  printf("%I64d\n", acc);
  return 0;
}
