#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int d, n, m;
set<pair<int, int> > S;
pair<int, int> p[200000];
int main() {
  scanf("%d%d%d", &d, &n, &m);
  S.insert(make_pair(0, n));
  S.insert(make_pair(d, d));
  for (int(i) = (0); (i) <= (m - 1); (i) += (1))
    scanf("%d%d", &p[i].second, &p[i].first);
  sort(p, p + m);
  long long ans = 0;
  for (int(i) = (0); (i) <= (m - 1); (i) += (1)) {
    int cost = p[i].first, x = p[i].second, y = min(d, x + n);
    auto it = S.upper_bound(make_pair(x, 1987654321));
    if (it == S.end()) continue;
    y = min(y, it->first);
    auto it2 = it;
    it2--;
    x = max(x, it2->second);
    if (x >= y) continue;
    ans += (long long)cost * (y - x);
    int nx = x, ny = y;
    if (it2->second == x) {
      nx = it2->first;
      S.erase(it2);
    }
    if (it->first == y) {
      ny = it->second;
      S.erase(it);
    }
    S.insert(make_pair(nx, ny));
  }
  if (*S.begin() != make_pair(0, d)) return !printf("-1");
  printf("%lld", ans);
}
