#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
template <typename T>
inline T const &MAX(T const &a, T const &b) {
  return a > b ? a : b;
}
template <typename T>
inline T const &MIN(T const &a, T const &b) {
  return a < b ? a : b;
}
inline long long mul(long long a, long long b, long long c) {
  return (a * b - (long long)((long double)a * b / c) * c + c) % c;
}
inline long long qp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000007;
    a = a * a % 1000000007, b >>= 1;
  }
  return ans;
}
inline long long qp(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a, c);
    a = mul(a, a, c), b >>= 1;
  }
  return ans;
}
using namespace std;
const unsigned long long ba = 233;
const double eps = 1e-5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 200000 + 10, maxn = 2000000 + 10, inf = 0x3f3f3f3f;
pair<int, int> p[N];
int q[N], top, r[N];
int main() {
  int d, n, m;
  scanf("%d%d%d", &d, &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d%d", &p[i].first, &p[i].second);
  sort(p + 1, p + 1 + m);
  for (int i = m; i >= 1; i--) {
    while (top && p[q[top]].second > p[i].second) top--;
    r[i] = (top ? q[top] : m + 1);
    q[++top] = i;
  }
  int now = 0, gas = n;
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    gas -= p[i].first - now;
    now = p[i].first;
    if (gas < 0) return 0 * puts("-1");
    int te;
    if (r[i] == m + 1)
      te = min(max(0, d - now - gas), n - gas);
    else
      te = min(max(0, p[r[i]].first - now - gas), n - gas);
    gas += te;
    ans += 1ll * te * p[i].second;
  }
  if (gas < d - now) return 0 * puts("-1");
  printf("%lld\n", ans);
  return 0;
}
