#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1.01e9;
const long double EPS = 1e-9;
const long double PI = acos(-1.0L);
void precalc() {}
int d, n, m;
const int maxn = (int)2e5 + 10;
pair<int, int> tosort[maxn];
bool read() {
  if (scanf("%d%d%d", &n, &d, &m) < 3) {
    return 0;
  }
  for (int i = 0; i < m; ++i) {
    int x, p;
    scanf("%d%d", &x, &p);
    tosort[i] = (make_pair(x, p));
  }
  return 1;
}
pair<int, int> mns[maxn];
int mleft, mright;
void add(int pos) {
  while (mleft < mright && tosort[pos].second < mns[mright - 1].first) {
    --mright;
  }
  mns[mright++] = make_pair(tosort[pos].second, pos);
}
void solve() {
  tosort[m++] = make_pair(n, INF);
  sort(tosort, tosort + m);
  mleft = 0, mright = 0;
  int gas = d, x = 0;
  long long res = 0;
  for (int i = 0, j = 0; i < m; ++i) {
    if (x + gas < tosort[i].first) {
      printf("-1\n");
      return;
    }
    gas -= tosort[i].first - x;
    x = tosort[i].first;
    while (j < m && tosort[j].first - x <= gas) {
      add(j);
      ++j;
    }
    assert(mleft < mright);
    while (j < m && mns[mleft].second == i) {
      int needgas = tosort[j].first - x;
      assert(gas <= needgas);
      int tmp = min(needgas, d) - gas;
      res += (long long)tmp * tosort[i].second;
      gas += tmp;
      if (gas == needgas) {
        add(j);
        ++j;
      } else {
        break;
      }
    }
    if (mns[mleft].second == i) {
      ++mleft;
    }
  }
  printf(
      "%lld"
      "\n",
      res);
}
int main() {
  srand(rdtsc());
  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}
