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;
const long long linf = 10000000000000043;
const int inf = 1000000043;
void pause(bool a = true) {}
template <class T>
inline const T sqr(const T &x) {
  return x * x;
}
template <class T>
inline T dist(pair<T, T> a, pair<T, T> b) {
  return sqrt(sqr(a.first - b.first) + sqr(a.second - b.second));
}
template <class T>
inline T prod(pair<T, T> a, pair<T, T> b, pair<T, T> c = make_pair(0, 0)) {
  return (a.first - c.first) * (b.second - c.second) -
         (a.second - c.second) * (b.first - c.first);
}
template <class T>
inline bool intriangle(pair<T, T> a, pair<T, T> b, pair<T, T> c, pair<T, T> d) {
  return (abs(prod(a, b, c)) ==
          abs(prod(a, b, d)) + abs(prod(a, c, d)) + abs(prod(b, c, d)));
}
template <class T>
inline int sg(T a) {
  return (a < 0 ? -1 : a ? 1 : 0);
}
long long rng(long long a, long long b) {
  return (((((long long)rand()) << 16) + rand()) % (b - a + 1)) + a;
}
bool inConvPoly(const vector<pair<long long, long long>> &a,
                pair<long long, long long> b) {
  long long l = 1;
  long long r = a.size() - 1;
  if (sg(prod(a[l], b, a[0])) * sg(prod(a[r], b, a[0])) >= 0) return false;
  if (intriangle(a[l], a[r], a[0], b)) return true;
  while (l != r - 1)
    (prod(a[(l + r) / 2], b, a[0]) < 0) ? l = (l + r) / 2 : r = (l + r) / 2;
  return sg(prod(b, a[r], a[l])) * sg(prod(b, a[0], a[l])) < 0;
}
template <class T>
T mex(vector<T> a) {
  set<T> b(a.begin(), a.end());
  for (int i = 0;; ++i)
    if (!b.count(i)) return i;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long popcnt(long long mask) {
  long long cnt = 0;
  while (mask) cnt += mask % 2, mask /= 2;
  return cnt;
}
unsigned long long powi(unsigned long long a, unsigned long long b,
                        long long mod = 1000000007) {
  if (b < 2) return b ? a : 1;
  return (powi((a * a) % mod, b / 2, mod) * (b % 2 ? a : 1LL)) % mod;
}
bool isn(char c) { return ('0' <= c && c <= '9'); }
template <class T>
bool read(T &out) {
  int c = getchar(), sign = 1;
  T num = 0;
  for (; !isn(c) && c != '-'; c = getchar())
    if (c == EOF) return false;
  if (c == '-') {
    sign = -1;
    c = getchar();
  }
  if (c == EOF) return false;
  for (; isn(c); c = getchar()) num = num * 10 + c - '0';
  out = sign * num;
  return true;
}
long long time_limit = 1000000;
long long start = clock();
bool time_break() {
  int g = clock();
  return (clock() - start > time_limit * 0.9);
}
long long fact(long long n, long long mod = linf) {
  long long g = 1;
  for (int i = 0; i < (n); i++) g *= (i + 1);
  return g;
}
void init(long long tl = 1000000) {
  ios::sync_with_stdio(false);
  srand(time(0));
  time_limit = tl;
}
template <class T>
bool maxz(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool minz(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool maxze(T &a, T b) {
  if (a <= b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool minze(T &a, T b) {
  if (a >= b) {
    a = b;
    return true;
  }
  return false;
}
long long mod7 = 1000000007;
long long mod9 = 1000000009;
bool isprime(long long n) {
  if (n < 2) return 0;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long randLL() {
  return (((long long)rand()) << 47) + (((long long)rand()) << 31) +
         (((long long)rand()) << 15) + (((long long)rand()) >> 1);
}
bool isprimeL(long long n, int it = 50) {
  if (n < 2) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (int i = 0; i < (it); i++) {
    long long x = randLL() % (n - 1) + 1;
    if (gcd(x, n) != 1) return 0;
    if (powi(x, n - 1, n) != 1) return 0;
  }
  return 1;
}
struct Min {
  vector<pair<long long, long long>> t;
  long long mx = 0;
  long long n = 0;
  vector<long long> a;
  void build(long long v, long long tl, long long tr) {
    if (tl == tr) {
      t[v] = make_pair(a[tl], tl);
      return;
    }
    long long tm = (tl + tr) >> 1;
    build(2 * v, tl, tm);
    build(2 * v + 1, tm + 1, tr);
    if (t[v * 2].first < t[v * 2 + 1].first)
      t[v] = t[v * 2];
    else
      t[v] = t[v * 2 + 1];
  }
  void init(long long n_, vector<long long> a_) {
    n = n_;
    a = a_;
    t.assign(4 * n, make_pair(0, 0));
    build(1, 0, a.size() - 1);
  }
  pair<long long, long long> get(long long v, long long tl, long long tr,
                                 long long l, long long r) {
    if (l < tl || r > tr || l > r) return make_pair(inf, -1);
    if (tl == l && tr == r) {
      return t[v];
    }
    long long tm = (tl + tr) / 2;
    pair<long long, long long> gl = get(v * 2, tl, tm, l, min(tm, r));
    pair<long long, long long> gr =
        get(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
    if (gl.first < gr.first)
      return gl;
    else
      return gr;
  }
};
int main() {
  ios::sync_with_stdio(false);
  long long n, d, m;
  cin >> d >> n >> m;
  map<long long, long long> p;
  vector<long long> a(m);
  vector<long long> x(m);
  vector<pair<long long, long long>> f;
  for (int i = 0; i < (m); i++) {
    cin >> x[i] >> a[i];
    f.push_back(make_pair(x[i], a[i]));
  }
  sort((f).begin(), (f).end());
  for (int i = 0; i < (m); i++) x[i] = f[i].first;
  for (int i = 0; i < (m); i++) a[i] = f[i].second;
  for (int i = 0; i < (m); i++) p[x[i]] = i;
  a.push_back(0);
  x.push_back(d);
  p[d] = m;
  Min st;
  st.init(m, a);
  long long l = 0;
  long long r = n;
  long long ans = 0;
  bool ok = true;
  long long pc = 0;
  long long el = n;
  int last = 0;
  while (r != d) {
    auto itl = p.upper_bound(l);
    long long lt = itl->second;
    auto itr = p.upper_bound(r);
    if (itl == itr) {
      ok = false;
    }
    itr--;
    long long rt = itr->second;
    pair<long long, long long> mn = st.get(1, 0, m, lt, rt);
    if (mn.second == -1) {
      ok = false;
      break;
    }
    while (last != m && x[last] <= r) last++;
    long long dx = min(x[mn.second] - l, x[last] - r);
    if (dx > n) {
      ok = false;
      break;
    }
    ans += mn.first * dx;
    l += dx;
    r += dx;
  }
  if (ok)
    cout << ans << endl;
  else
    cout << -1 << endl;
  pause(1);
  return 0;
}
