Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point d.

Johnny's truck has a gas tank that holds exactly n liters, and his tank is initially full. As he drives, the truck consumes exactly one liter per unit distance traveled. Moreover, there are m gas stations located at various points along the way to the district center. The i-th station is located at the point xi on the number line and sells an unlimited amount of fuel at a price of pi dollars per liter. Find the minimum cost Johnny must pay for fuel to successfully complete the delivery.

Input

The first line of input contains three space separated integers d, n, and m (1 ≤ n ≤ d ≤ 109, 1 ≤ m ≤ 200 000) — the total distance to the district center, the volume of the gas tank, and the number of gas stations, respectively.

Each of the next m lines contains two integers xi, pi (1 ≤ xi ≤ d - 1, 1 ≤ pi ≤ 106) — the position and cost of gas at the i-th gas station. It is guaranteed that the positions of the gas stations are distinct.

Output

Print a single integer — the minimum cost to complete the delivery. If there is no way to complete the delivery, print -1.

Examples

Input

10 4 4
3 5
5 8
6 3
8 4


Output

22


Input

16 5 2
8 2
5 1


Output

-1

Note

In the first sample, Johnny's truck holds 4 liters. He can drive 3 units to the first gas station, buy 2 liters of gas there (bringing the tank to 3 liters total), drive 3 more units to the third gas station, buy 4 liters there to fill up his tank, and then drive straight to the district center. His total cost is 2·5 + 4·3 = 22 dollars.

In the second sample, there is no way for Johnny to make it to the district center, as his tank cannot hold enough gas to take him from the latest gas station to the district center.
#include <bits/stdc++.h>
using namespace std;
int d, limit, numposto;
pair<int, int> ipiranga[200010];
long long int resp = 0;
class RMQ {
 private:
  vector<int> st;
  int n;
  int left(int p) { return p << 1; }
  int right(int p) { return (p << 1) + 1; }
  void build(int p, int l, int r) {
    if (l == r)
      st[p] = 0;
    else {
      build(left(p), l, (l + r) / 2);
      build(right(p), (l + r) / 2 + 1, r);
      st[p] = st[left(p)] + st[right(p)];
    }
  }
  int queryy(int p, int l, int r, int i, int j) {
    if (i > r or j < l)
      return -1;
    else if (l >= i and j >= r)
      return st[p];
    else {
      int aux1 = queryy(left(p), l, (l + r) / 2, i, j);
      int aux2 = queryy(right(p), (l + r) / 2 + 1, r, i, j);
      if (aux1 == -1)
        return aux2;
      else if (aux2 == -1)
        return aux1;
      else {
        if (ipiranga[aux1].second < ipiranga[aux2].second)
          return aux1;
        else
          return aux2;
      }
    }
  }
  void updatee(int p, int l, int r, int pinto, int val) {
    if (pinto < l or pinto > r) return;
    if (l == r and l == pinto) {
      st[p] = val;
      return;
    } else {
      int mid = (l + r) / 2;
      if (pinto <= mid)
        updatee(left(p), l, (l + r) / 2, pinto, val);
      else
        updatee(right(p), (l + r) / 2 + 1, r, pinto, val);
      if (st[left(p)] == -1)
        st[p] = st[right(p)];
      else if (st[right(p)] == -1)
        st[p] = st[left(p)];
      else {
        if (ipiranga[st[left(p)]].second < ipiranga[st[right(p)]].second)
          st[p] = st[left(p)];
        else
          st[p] = st[right(p)];
      }
    }
  }

 public:
  RMQ(int N) {
    st.assign(4 * N, 0);
    build(1, 1, N);
  }
  int query(int i, int j, int tam) { return queryy(1, 1, tam, i, j); }
  void update(int pinto, int val, int tam) { updatee(1, 1, tam, pinto, val); }
};
RMQ seg(200010);
int bb(int pos, int esq, int dir) {
  if (esq >= dir) return esq;
  int meio = (esq + dir + 1) / 2;
  if (ipiranga[meio].first - pos <= limit)
    return bb(pos, meio, dir);
  else
    return bb(pos, esq, meio - 1);
}
int bb2(int comeco, int esq, int dir) {
  if (esq >= dir) return esq;
  int meio = (esq + dir) / 2;
  if (ipiranga[seg.query(comeco + 1, meio, numposto + 1)].second <=
      ipiranga[comeco].second)
    return bb2(comeco, esq, meio);
  else
    return bb2(comeco, meio + 1, dir);
}
void resorve(int index, int qtosobra) {
  if (index == numposto + 1) return;
  int temp = bb(ipiranga[index].first, index + 1, numposto + 1);
  if (ipiranga[seg.query(index + 1, temp, numposto + 1)].second <=
      ipiranga[index].second) {
    int seguinte = bb2(index, index + 1, temp);
    if (qtosobra > ipiranga[seguinte].first - ipiranga[index].first) {
      resorve(seguinte,
              qtosobra - (ipiranga[seguinte].first - ipiranga[index].first));
    } else {
      resp += (ipiranga[seguinte].first - ipiranga[index].first - qtosobra) *
              (long long int)(ipiranga[index].second);
      resorve(seguinte, 0);
    }
  } else {
    int seguinte = seg.query(index + 1, temp, numposto + 1);
    int auxxx = limit - (ipiranga[seguinte].first - ipiranga[index].first);
    resp += (long long int)(limit - qtosobra) *
            (long long int)(ipiranga[index].second);
    resorve(seguinte, auxxx);
  }
}
bool confere() {
  if (ipiranga[1].first > limit) return false;
  for (int i = 2; i <= numposto + 1; i++) {
    if (ipiranga[i].first - ipiranga[i - 1].first > limit) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> d >> limit >> numposto;
  for (int i = 1; i <= numposto; i++) {
    cin >> ipiranga[i].first >> ipiranga[i].second;
  }
  ipiranga[numposto + 1] = (make_pair(d, 0));
  sort(ipiranga + 1, ipiranga + numposto + 1);
  if (!confere()) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i <= numposto; i++) {
    seg.update(i, i, numposto + 1);
  }
  int temp = bb(0, 1, numposto + 1);
  int firstposto = seg.query(1, temp, numposto + 1);
  resorve(firstposto, limit - ipiranga[firstposto].first);
  cout << resp << endl;
  return 0;
}
