#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
bool mini(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
bool maxi(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const int N = 4e5 + 5;
const int oo = 1e9;
int ans[N];
int a[N];
int v[N];
int d, n, m, cur;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> d >> n >> m;
  cur = n;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> v[i];
  }
  a[++m] = d;
  vector<int> id(m, 0);
  iota(id.begin(), id.end(), 1);
  sort(id.begin(), id.end(), [](int i, int j) { return a[i] < a[j]; });
  deque<int> q;
  for (int i : id) {
    while (cur < a[i]) {
      while (q.size() && cur - a[q.front()] >= n) q.pop_front();
      if (!q.size()) return cout << -1, 0;
      int des = min(a[i], a[q.front()] + n);
      ans[q.front()] += des - cur;
      cur = des;
    }
    while (q.size() && v[i] <= v[q.back()]) q.pop_back();
    q.push_back(i);
  }
  long long res = 0;
  for (int i = 1; i < m; i++) res += (long long)v[i] * ans[i];
  cout << res << "\n";
  return 0;
}
