#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(false);
  int dest, cap, n;
  std::scanf("%d %d %d", &dest, &cap, &n);
  std::vector<std::pair<int, int>> v;
  v.resize(n + 2);
  int x, y;
  for (int i = 0; i < n; i++) {
    std::scanf("%d %d", &x, &y);
    v[i] = {x, y};
  }
  v[n] = {0, 0};
  v[n + 1] = {dest, 0};
  std::sort(v.begin(), v.end());
  n += 2;
  std::multiset<std::pair<int, int>> s;
  long long price = 0;
  int j = 0;
  for (int i = 0; i < n - 1; i++) {
    int cpos = v[i].first;
    int next = v[i + 1].first;
    s.insert({v[i].second, v[i].first});
    while (cpos < next) {
      while (v[j].first + cap <= cpos && j <= i)
        s.erase({v[j].second, v[j].first}), ++j;
      if (!s.size()) {
        printf("-1\n");
        return 0;
      }
      int take = std::min(next - cpos, cap - (cpos - s.begin()->second));
      price += (long long)(take)*s.begin()->first;
      cpos += take;
    }
  }
  printf("%I64d\n", price);
  return 0;
}
