#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 0, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
int dis, vol, n;
pair<int, int> a[200020];
long long cost[200020];
int top = 0;
long long num[200020];
long long solve() {
  long long spend = 0;
  int h = 1;
  int t = 1;
  cost[1] = 0;
  num[1] = vol;
  for (int i = 1; i <= n; ++i) {
    int d = a[i].first - a[i - 1].first;
    if (d > vol) return -1;
    int more = d;
    while (h <= t && num[h] <= d) {
      d -= num[h];
      ++h;
    }
    num[h] -= d;
    while (t >= h && cost[t] >= a[i].second) {
      spend -= (long long)num[t] * cost[t];
      more += num[t];
      --t;
    }
    cost[++t] = a[i].second;
    num[t] = more;
    spend += (long long)a[i].second * more;
  }
  return spend;
}
int main() {
  while (~scanf("%d%d%d", &dis, &vol, &n)) {
    for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].first, &a[i].second);
    ++n;
    a[n].first = dis;
    a[n].second = 0;
    sort(a + 1, a + n + 1);
    printf("%lld\n", solve());
  }
  return 0;
}
