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 *x*<sub class="lower-index">*i*</sub> on the number line and sells an unlimited amount of fuel at a price of *p*<sub class="lower-index">*i*</sub> dollars per liter. Find the minimum cost Johnny must pay for fuel to successfully complete the delivery.
The first line of input contains three space separated integers *d*, *n*, and *m* (1 ≤ *n* ≤ *d* ≤ 10<sup class="upper-index">9</sup>, 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 *x*<sub class="lower-index">*i*</sub>, *p*<sub class="lower-index">*i*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ *d* - 1, 1 ≤ *p*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">6</sup>) — the position and cost of gas at the *i*-th gas station. It is guaranteed that the positions of the gas stations are distinct.
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.
10 4 4
3 5
5 8
6 3
8 4
22
16 5 2
8 2
5 1
-1
400000000 400000000 3
1 139613
19426 13509
246298622 343529
0
229 123 2
170 270968
76 734741
50519939
153 105 1
96 83995
4031760
281 12 23
178 650197
129 288456
34 924882
43 472160
207 957083
103 724815
167 308008
135 906958
74 242828
229 146026
85 241042
22 39127
62 47524
113 760274
156 562141
10 209057
50 714473
201 164128
97 624021
120 102709
147 388268
219 933977
190 950684
-1
def possible(destination,maxfuel, station):  #проверяет, возможно ли вообще доехать
    if station[0] > maxfuel or destination - station[len(station) - 1] > maxfuel:
        return False
    for j in range(len(station) - 1):
        if station[j + 1] - station[j] > maxfuel:
            return False
    return True
def cheapest_available(position, fuel, station, price):
    min_price = 999999
    for j in range(len(station)):
        if station[j] > position and price[j] < min_price and station[j] - position <= fuel:
            location = station[j]
            min_price = price[j]
    return(location, min_price)
def cheaper(position, current_price, station, price):
    for j in range(len(station)):
        if station[j] > position and price[j] < current_price:
            return (station[j], price[j])
    return False
def route(position, destination, fuel, maxfuel, station, price, money):
    if destination - position <= fuel:
        return money
    elif possible(destination, maxfuel, station) is False:
        return -1
    else:
        (temp1, temp2) = cheapest_available(position, fuel, station, price)
        if cheaper(temp1, temp2, station, price) is False:
            if destination - temp1 <= maxfuel:
                return money + (destination - fuel - position)*temp2
            else:
                return route(temp1, destination, maxfuel, maxfuel, station, price, money + (maxfuel - fuel + temp1 - position)*temp2)
        else:
            (pep1, pep2) = cheaper(temp1, temp2, station, price)
            if pep1 - temp1 <= maxfuel:
                return route(temp1, destination, pep1 - temp1 , maxfuel, station, price, money + (pep1 - fuel)*temp2)
            else:
                return route(temp1, destination, maxfuel, maxfuel, station, price, money + (maxfuel - fuel + temp1)*temp2)

a = input().split(' ')
destination = int(a[0])
maxfuel = int(a[1])
kek = int(a[2])
station, price = [], []
for j in range(kek):
    lol = input().split(' ')
    station.append(int(lol[0]))
    price.append(int(lol[1]))
print(route(0, destination, maxfuel, maxfuel, station, price, 0))