#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
inline bool Min(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
inline bool Max(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
inline int ni() {
  int a;
  scanf("%d", &a);
  return a;
}
inline ll nl() {
  ll a;
  scanf("%lld", &a);
  return a;
}
inline double nd() {
  double a;
  scanf("%lf", &a);
  return a;
}
inline void pi(int a) { printf("%d ", a); }
inline void pl(ll a) { printf("%lld ", a); }
inline void pd(double a) { printf("%.12lf ", a); }
void check(int n) {
  if (n < 0) {
    puts("-1");
    exit(0);
  }
}
void solve() {
  int dist = ni();
  int maxi = ni();
  int n = ni();
  vector<pii> xs(n);
  vector<int> next(n);
  for (int i = 0; i < (int)(n); ++i) xs[i] = {ni(), ni()};
  sort((xs).begin(), (xs).end());
  stack<int> st;
  for (int i = n - 1; i >= 0; i--) {
    while (st.size() and xs[st.top()].second >= xs[i].second) st.pop();
    if (st.size())
      next[i] = st.top();
    else
      next[i] = -1;
    st.push(i);
  }
  int cur = maxi - xs[0].first;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    check(cur);
    int need =
        min(maxi, (next[i] == -1 ? dist : xs[next[i]].first) - xs[i].first);
    if (need > cur) {
      ans += 1LL * (need - cur) * xs[i].second;
      cur = need;
    }
    cur -= (i + 1 == n ? dist : xs[i + 1].first) - xs[i].first;
  }
  check(cur);
  pl(ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand((int)clock());
  solve();
  return 0;
}
