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.
import java.io.*;
import static java.lang.Math.*;

import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.lang.*;

public class Main {
    final static boolean debug = false;
    final static String fileName = "";
    final static boolean useFiles = false;

    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter writer = new PrintWriter(System.out);
        new Task(new InputReader(System.in), writer).solve();
        writer.close();
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public byte nextByte() {
        return Byte.parseByte(next());
    }
}

class Station implements Comparable<Station>{
    int Location, Cost, Index;
    Station(int location, int cost){
        Location = location;
        Cost = cost;
    }

    @Override
    public int compareTo(Station o) {
        if (Cost == o.Cost) return Location - o.Location;
        return Cost - o.Cost;
    }
}

class SumInIntervalAddToElementSegmentTree {
    private int[] t;
    private int n;

    SumInIntervalAddToElementSegmentTree(int n) {
        this.n = n;
        t = new int[Integer.highestOneBit(n) << 2];
    }

    SumInIntervalAddToElementSegmentTree(int[] array) {
        this(array.length);
        build(0, 0, n - 1, array);
    }

    private void build(int v, int tl, int tr, int[] array) {
        if (tr == tl) {
            t[v] = array[tl];
        } else {
            int tm = (tl + tr) >> 1;
            build(2 * v + 1, tl, tm, array);
            build(2 * v + 2, tm + 1, tr, array);
            t[v] = t[2 * v + 1] + t[2 * v + 2];
        }
    }

    int get(int l, int r) {
        if (l > n || r > n || 0 > l || 0 > r)
            throw new IllegalArgumentException("indices: (" + l + ", " + r + ") . Bounds: (0, "+ (n - 1));
        return get(0, 0, n - 1, l, r);
    }

    void add(int index, int value) {
        if (0 > index || index > n)
            throw new IllegalArgumentException("index: " + index + ". Bounds: " + (n - 1));
        set(0, 0, n - 1, index, value);
    }

    int search(int value) {
        return search(0, 0, n - 1, value);
    }

    private int search(int v, int tl, int tr, int value) {
        if (tl == tr)
            return tr;

        int tm = (tl + tr) / 2;
        if (value <= t[2 * v + 1])
            return search(2 * v + 1, tl, tm, value);
        return search(2 * v + 2, tm + 1, tr, value - t[2 * v + 1]);
    }

    private int get(int v, int tl, int tr, int l, int r) {
        if (l > r)
            return 0;
        if (tl == l && tr == r)
            return t[v];
        int tm = (tl + tr) >> 1;
        return get(2 * v + 1, tl, tm, l, Math.min(tm, r)) +
                get(2 * v + 2, tm + 1, tr, Math.max(tm + 1, l), r);
    }

    private void set(int v, int tl, int tr, int index, int value) {
        if (tr == tl)
            t[v] += value;
        else {
            int tm = (tl + tr) >> 1;
            if (index <= tm)
                set(2 * v + 1, tl, tm, index, value);
            else
                set(2 * v + 2, tm + 1, tr, index, value);
            t[v] = t[2 * v + 1] + t[2 * v + 2];
        }
    }

    public int[] toArray() {
        int[] result = new int[n];
        for (int i = 0; i < n; i++)
            result[i] = get(i, i);
        return result;
    }

    @Override
    public String toString() {
        String result = "";
        for (int i = 0; i < n; i++)
            result += get(i, i) + " ";
        return result;
    }
}

class Task {
    public void solve() {
        int d = in.nextInt();
        int n = in.nextInt();
        int m = in.nextInt();
        Station[] stations = new Station[m + 1];
        for (int i = 0; i < m; i++) {
            stations[i] = new Station(in.nextInt(), in.nextInt());
        }
        stations[m] = new Station(d, (int)1e9);
        Arrays.sort(stations, (a, b) -> {
            if (a.Location == b.Location) return a.Cost - b.Cost;
            return a.Location - b.Location;
        });
        for (int i = 0; i <= m; i++) stations[i].Index = i;
        TreeSet<Station> set = new TreeSet<>();
        SumInIntervalAddToElementSegmentTree tree = new SumInIntervalAddToElementSegmentTree(m);

        int power = n;
        long totalCost = 0;
        int left = 0;
        for (int i = 0; i <= m; i++){
            power -= stations[i].Location - (i == 0 ? 0 : stations[i - 1].Location);
            /*for (Station s : set){
                out.println(s.Location + " " + s.Cost);
            }
            out.println();*/
            while (power < 0) {
                if (set.isEmpty()){
                    out.println(-1);
                    return;
                }
                Station s = set.first();
                if (s.Index == m){
                    out.println(-1);
                    return;
                }
                int maxAdd = n - (tree.get(0, s.Index) - s.Location + n);

                int add = min(-power, maxAdd);
                power += add;
                totalCost += add * (long)s.Cost;
                tree.add(s.Index, add);

                if (add == maxAdd) {
                    for (; left <= s.Index; left++) {
                        set.remove(stations[left]);
                    }
                }
            }
            set.add(stations[i]);
        }
        //out.println(tree);
        out.println(totalCost);
    }

    private InputReader in;
    private PrintWriter out;

    Task(InputReader in, PrintWriter out) {
        this.in = in;
        this.out = out;
    }
}