#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char* x) { cerr << '\"' << x << '\"'; }
void __print(const string& x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V>& x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T& x) {
  int f = 0;
  cerr << '{';
  for (auto& i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long d, c, m;
  cin >> d >> c >> m;
  vector<array<long long, 2>> A(m);
  for (int i = 0; i < m; ++i) {
    cin >> A[i][0] >> A[i][1];
  }
  A.push_back({d, 0});
  A.insert(A.begin(), {0, 0});
  sort(A.begin(), A.end());
  m += 2;
  long long ans = 0;
  deque<array<long long, 2>> dq;
  dq.push_back({0, c});
  long long curv = d;
  for (int i = 1; i < m; ++i) {
    long long dist = A[i][0] - A[i - 1][0];
    if (dist > c) {
      cout << -1 << "\n";
      return 0;
    }
    long long tdist = dist;
    while (dist > 0 && !dq.empty()) {
      long long tk = min(dq.front()[1], dist);
      dq.front()[1] -= tk;
      dist -= tk;
      if (dq.front()[1] == 0) {
        dq.pop_front();
      }
    }
    long long add = 0;
    while (!dq.empty()) {
      if (dq.back()[0] >= A[i][1]) {
        ans -= dq.back()[0] * dq.back()[1];
        add += dq.back()[1];
        dq.pop_back();
      } else {
        break;
      }
    }
    dist = tdist;
    long long ntk = dist;
    ntk += add;
    ans += ntk * A[i][1];
    dq.push_back({A[i][1], ntk});
  }
  cout << ans << "\n";
  return 0;
}
