#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f, N = 2e5 + 10;
template <class T>
inline bool chkmin(T &A, T B) {
  return B < A ? A = B, 1 : 0;
}
template <class T>
inline bool chkmax(T &A, T B) {
  return A < B ? A = B, 1 : 0;
}
int n, m, d;
int nxt[N], stk[N], top;
pair<int, int> A[N];
int main() {
  scanf("%d%d%d", &d, &m, &n);
  for (int i = (1), i_end = (n); i <= i_end; ++i)
    scanf("%d%d", &A[i].first, &A[i].second);
  A[++n] = make_pair(d, 0);
  sort(A + 1, A + 1 + n);
  for (int i = (n - 1), i_end = (1); i >= i_end; --i) {
    while (top && A[i].second < A[stk[top]].second) --top;
    nxt[i] = (top ? stk[top] : n);
    stk[++top] = i;
  }
  for (int i = (2), i_end = (n); i <= i_end; ++i)
    if (A[i].first - A[i - 1].first > m) {
      puts("-1");
      return 0;
    }
  int now = m - A[1].first;
  long long ans = 0;
  for (int i = (1), i_end = (n - 1); i <= i_end; ++i) {
    int to;
    to = A[nxt[i]].first - A[i].first;
    chkmin(to, m);
    if (now < to) {
      ans += 1ll * A[i].second * (to - now);
      now = to;
    }
    now -= A[i + 1].first - A[i].first;
  }
  printf("%lld\n", ans);
  return 0;
}
