#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,no-stack-protector")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
template <typename T>
vector<T> &operator<<(vector<T> &__container, T x) {
  __container.push_back(x);
  return __container;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &__container) {
  for (T _ : __container) out << _ << ' ';
  return out;
}
void sci() {}
template <typename... Args>
void sci(int &x, Args &...args) {
  scanf("%d", &x);
  sci(args...);
}
void scl() {}
template <typename... Args>
void scl(long long int &x, Args &...args) {
  scanf("%lld", &x);
  scl(args...);
}
const int MAXN = 2e5 + 7;
int n, d, m;
pair<int, int> A[MAXN];
struct SegmentTree {
  int maxx[MAXN << 2], l[MAXN << 2], r[MAXN << 2], lazy[MAXN << 2];
  void pushdown(int rt) {
    if (!lazy[rt]) return;
    maxx[rt << 1] += lazy[rt];
    lazy[rt << 1] += lazy[rt];
    maxx[rt << 1 | 1] += lazy[rt];
    lazy[rt << 1 | 1] += lazy[rt];
    lazy[rt] = 0;
  }
  void build(int L, int R, int rt = 1) {
    l[rt] = L;
    r[rt] = R;
    maxx[rt] = lazy[rt] = 0;
    if (l[rt] + 1 == r[rt]) return;
    int mid = (l[rt] + r[rt]) >> 1;
    build(L, mid, rt << 1);
    build(mid, R, rt << 1 | 1);
  }
  void modify(int L, int R, int x, int rt = 1) {
    if (L >= r[rt] or l[rt] >= R) return;
    if (L <= l[rt] and r[rt] <= R) {
      lazy[rt] += x;
      maxx[rt] += x;
      return;
    }
    pushdown(rt);
    modify(L, R, x, rt << 1);
    modify(L, R, x, rt << 1 | 1);
    maxx[rt] = max(maxx[rt << 1], maxx[rt << 1 | 1]);
  }
  int qmax(int L, int R, int rt = 1) {
    if (l[rt] >= R or L >= r[rt]) return -0x3f3f3f3f;
    if (L <= l[rt] and r[rt] <= R) return maxx[rt];
    pushdown(rt);
    return max(qmax(L, R, rt << 1), qmax(L, R, rt << 1 | 1));
  }
} seg;
void solve() {
  sci(n, d, m);
  seg.build(0, m + 2);
  for (int i = 1; i <= m; i++) sci(A[i].first, A[i].second);
  A[++m] = make_pair(n, 0x3f3f3f3f);
  sort(A + 1, A + 1 + m);
  for (int i = 1; i <= m; i++) seg.modify(i, i + 1, -A[i].first);
  A[0] = make_pair(0, 0);
  long long int ret = 0;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      que;
  for (int i = 0; i <= m; i++) {
    int dt = -seg.qmax(i, i + 1);
    if (dt > 0) {
      while (dt and !que.empty()) {
        auto p = que.top();
        int maxd = d - seg.qmax(p.second, m + 1);
        if (maxd > 0) {
          int del = min(maxd, dt);
          ret += 1ll * del * p.first;
          dt -= del;
          maxd -= del;
          seg.modify(p.second, m + 1, del);
        }
        assert(maxd >= 0);
        if (!maxd) que.pop();
      }
      if (dt > 0) {
        cout << -1 << "\n";
        return;
      }
    }
    que.push(make_pair(A[i].second, i));
  }
  cout << ret << "\n";
}
int main() {
  solve();
  return 0;
}
