#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000, inf = 1000 * 1000 * 1000;
struct vertex {
  int x, pos;
  vertex *l, *r;
  vertex(int x) : x(x), l(NULL), r(NULL) {}
};
vertex* root;
int get(vertex* v) { return (v ? v->x : inf); }
int getPos(vertex* v) { return (v ? v->pos : -1); }
void update(int pos, int delta, vertex*& cur, int v = 1, int l = 1,
            int r = 1000 * 1000 * 1000) {
  if (!cur) cur = new vertex(inf);
  if (l == r)
    cur->x = delta, cur->pos = l;
  else {
    int m = (l + r) / 2;
    if (pos <= m)
      update(pos, delta, cur->l, v * 2, l, m);
    else
      update(pos, delta, cur->r, v * 2 + 1, m + 1, r);
    if (get(cur->l) < get(cur->r))
      cur->pos = getPos(cur->l);
    else
      cur->pos = getPos(cur->r);
    cur->x = min(get(cur->l), get(cur->r));
  }
}
pair<int, int> query(int l, int r, vertex*& cur, int tv = 1, int tl = 1,
                     int tr = 1000 * 1000 * 1000) {
  if (!cur) cur = new vertex(inf);
  if (l > r)
    return {inf, -1};
  else if (l == tl && r == tr)
    return {get(cur), getPos(cur)};
  else {
    int tm = (tl + tr) / 2;
    return min(query(l, min(r, tm), cur->l, tv * 2, tl, tm),
               query(max(tm + 1, l), r, cur->r, tv * 2 + 1, tm + 1, tr));
  }
}
pair<int, int> tryGet(int l, int r, int x, vertex*& cur, int tv = 1, int tl = 1,
                      int tr = 1000 * 1000 * 1000) {
  if (!cur) cur = new vertex(inf);
  if (l > r)
    return {inf, -1};
  else if (l == tl && r == tr) {
    vertex* temp = cur;
    while (true) {
      int m = (l + r) / 2;
      if (get(temp->l) <= x)
        temp = temp->l, r = m;
      else if (get(temp->r) <= x)
        temp = temp->r, l = m + 1;
      else
        break;
    }
    if (l == r)
      return {get(temp), l};
    else
      return {inf, -1};
  } else {
    int tm = (tl + tr) / 2;
    pair<int, int> get1 = tryGet(l, min(r, tm), x, cur->l, tv * 2, tl, tm);
    pair<int, int> get2 =
        tryGet(max(tm + 1, l), r, x, cur->r, tv * 2 + 1, tm + 1, tr);
    if (get1.first <= x)
      return get1;
    else if (get2.first <= x)
      return get2;
    else
      return {inf, -1};
  }
}
int main() {
  int d, n, m;
  cin >> d >> n >> m;
  root = new vertex(inf);
  for (int i = 0; i < m; i++) {
    int x, p;
    scanf("%d%d", &x, &p);
    update(x, p, root);
  }
  update(d, 0, root);
  int curPos = 0, lost = n, was = 0;
  long long ans = 0;
  while (curPos < d) {
    int getMinPos = query(curPos + 1, min(d, curPos + n), root).second;
    int getMin = query(curPos + 1, min(d, curPos + n), root).first;
    int mn = getMin;
    pair<int, int> temp = tryGet(curPos + 1, min(d, curPos + n), was, root);
    if (temp.second != -1) getMin = temp.first, getMinPos = temp.second;
    int dist = min(d - curPos, getMinPos - curPos);
    if (getMinPos == -1) {
      if (curPos + lost >= d)
        cout << ans << endl;
      else {
        dist = d - curPos;
        if (dist > n)
          cout << -1 << endl;
        else {
          cout << ans + 1LL * max(0, (dist - lost)) * was;
        }
      }
      return 0;
    }
    int need = max(0, dist - lost);
    if (was < mn) need = max(0, min(d - curPos, n) - lost);
    lost += need;
    ans += 1LL * need * was;
    was = getMin;
    lost -= dist;
    curPos = getMinPos;
  }
  cout << ans << endl;
  return 0;
}
