#include <bits/stdc++.h>
using namespace std;
const int mycount = 200005;
int result_array[mycount];
int thesize[mycount];
pair<int, int> a[mycount];
int n, total, thedistance, m;
void input() {
  scanf("%d %d %d", &thedistance, &n, &m);
  int i, j, k;
  for (i = 0; i < m; i++) {
    scanf("%d %d", &j, &k);
    a[i].first = j;
    a[i].second = k;
  }
  sort(a, a + m);
}
map<int, int> pool;
int thearray[mycount];
void process() {
  int i, k, l;
  if (a[0].first > n) {
    printf("-1\n");
    return;
  }
  long long total_gas = 0;
  long long ret = 0;
  int cur = n - a[0].first;
  int j = 0;
  a[m].first = thedistance;
  int carry_gas = 0;
  for (i = 0; i < m; i++) {
    if (a[i].first + n < a[i + 1].first) {
      printf("-1\n");
      return;
    }
    int gas_needed = a[i + 1].first - a[i].first;
    if (gas_needed <= cur) {
      cur -= gas_needed;
    } else {
      gas_needed -= cur;
      cur = 0;
      j = 0;
      for (map<int, int>::iterator it = pool.begin();
           it != pool.end() && gas_needed > 0 && it->first < a[i].second;
           it++) {
        if (it->second > gas_needed) {
          ret += (long long)gas_needed * it->first;
          pool[it->first] = it->second - gas_needed;
          total_gas -= gas_needed;
          gas_needed = 0;
          break;
        } else if (it->second == gas_needed) {
          ret += (long long)gas_needed * it->first;
          thearray[j++] = it->first;
          total_gas -= it->second;
          gas_needed = 0;
          break;
        } else {
          thearray[j++] = it->first;
          ret += (long long)it->second * it->first;
          total_gas -= it->second;
          gas_needed -= it->second;
        }
      }
      if (gas_needed > 0) {
        ret += (long long)a[i].second * gas_needed;
        pool.clear();
        total_gas = 0;
      } else {
        for (k = 0; k < j; k++) {
          pool.erase(thearray[k]);
        }
      }
    }
    carry_gas = (long long)n - (a[i + 1].first - a[i].first) - cur;
    if (carry_gas == 0) {
      pool.clear();
      continue;
    }
    while (!pool.empty()) {
      if (total_gas > carry_gas) {
        map<int, int>::iterator it = pool.end();
        it--;
        total_gas -= it->second;
        pool.erase(it);
        k = total_gas - carry_gas;
        if (it->second <= k) {
          total_gas -= it->second;
          pool.erase(it->first);
        } else {
          pool[it->first] = it->second - k;
          total_gas -= k;
        }
      } else if (pool.rbegin()->first > a[i].second) {
        total_gas -= pool.rbegin()->second;
        pool.erase(pool.rbegin()->first);
      } else {
        break;
      }
    }
    if (total_gas < carry_gas) {
      pool[a[i].second] += carry_gas - total_gas;
      total_gas = carry_gas;
    }
  }
  printf("%lld\n", ret);
}
int main() {
  input();
  process();
  return 0;
}
