Valera loves his garden, where *n* fruit trees grow.

This year he will enjoy a great harvest! On the *i*-th tree *b*<sub class="lower-index">*i*</sub> fruit grow, they will ripen on a day number *a*<sub class="lower-index">*i*</sub>. Unfortunately, the fruit on the tree get withered, so they can only be collected on day *a*<sub class="lower-index">*i*</sub> and day *a*<sub class="lower-index">*i*</sub> + 1 (all fruits that are not collected in these two days, become unfit to eat).

Valera is not very fast, but there are some positive points. Valera is ready to work every day. In one day, Valera can collect no more than *v* fruits. The fruits may be either from the same tree, or from different ones. What is the maximum amount of fruit Valera can collect for all time, if he operates optimally well?
The first line contains two space-separated integers *n* and *v* (1 ≤ *n*, *v* ≤ 3000) — the number of fruit trees in the garden and the number of fruits that Valera can collect in a day. 

Next *n* lines contain the description of trees in the garden. The *i*-th line contains two space-separated integers *a*<sub class="lower-index">*i*</sub> and *b*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> ≤ 3000) — the day the fruits ripen on the *i*-th tree and the number of fruits on the *i*-th tree.
n, v = map(int, input().split())
d = []
while n > 0:
    n -= 1
    a, b = map(int, input().split())
    d.append([a, b])
d.sort()
t = 0
i = 0
o = 0
for i in d:
    if i[1]+o <= v:
        t += v
        t += o
    else:
        t += v
        o += (i[1]-v)
t += min(o, v)
print(t)
