#include <bits/stdc++.h>
using namespace std;
const int MX = 310000, INF = (1 << 31) - 1, lim = (1 << 20);
int bit[lim + 10];
int get(int x) {
  int ret = INF;
  while (x > 0) {
    ret = min(ret, bit[x]);
    x -= x & (-x);
  }
  return ret;
}
void add(int x, int V) {
  while (x < lim) {
    bit[x] = min(bit[x], V);
    x += x & (-x);
  }
}
int D, Vol, n, must[MX];
pair<int, int> arr[MX];
int main() {
  scanf("%d %d %d", &D, &Vol, &n);
  for (int j = 0; j < lim; j++) bit[j] = D;
  for (int j = 1; j <= n; j++) {
    scanf("%d %d", &arr[j].first, &arr[j].second);
  }
  sort(arr + 1, arr + 1 + n);
  int mx = D - arr[n].first;
  arr[0].first = 0;
  for (int j = 1; j <= n; j++) mx = max(mx, arr[j].first - arr[j - 1].first);
  if (mx > Vol) {
    puts("-1");
    return 0;
  }
  for (int j = n; j; j--) {
    must[j] = min(Vol, get(arr[j].second) - arr[j].first);
    add(arr[j].second, arr[j].first);
  }
  long long ans = 0, tank = Vol - arr[1].first;
  for (int j = 1; j <= n; j++) {
    if (tank < must[j]) {
      ans += 1ll * arr[j].second * (must[j] - tank);
      tank = must[j];
    }
    if (j == n) break;
    tank -= (arr[j + 1].first - arr[j].first);
  }
  cout << ans << endl;
}
