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.
import sys
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
############ ---- Input Functions ---- ############

def Valera_and_Fruits():
    n,v = invr()
    
    num_fruits_acc_to_day_dict = {}

    for i in range(n):
        ai,bi = invr()
        if ai not in num_fruits_acc_to_day_dict.keys():
            num_fruits_acc_to_day_dict[ai] = bi
        else:
            num_fruits_acc_to_day_dict[ai] += bi 

    prev_day_remaining_fruits = 0
    total_collection = 0

    for day in range(1,3002):   #day can go from 1 to 3001 and on 3001, 3000th remaining fruits can be collected
        if day not in num_fruits_acc_to_day_dict.keys():
            space_in_bag = v 
            
            if prev_day_remaining_fruits <= space_in_bag:
                fruits_collected = prev_day_remaining_fruits
                space_in_bag -= fruits_collected
            
            else:
                fruits_collected = space_in_bag
                space_in_bag = 0
                
            prev_day_remaining_fruits = 0
            total_collection += fruits_collected
        
        else:
            fruits = num_fruits_acc_to_day_dict[day]
            space_in_bag = v

            if prev_day_remaining_fruits <= space_in_bag: 
                fruits_collected = prev_day_remaining_fruits
                space_in_bag -= fruits_collected

            else:
                fruits_collected = space_in_bag
                space_in_bag = 0 

            if fruits <= space_in_bag:
                fruits_collected += fruits
                prev_day_remaining_fruits = 0
            else:
                fruits_collected += space_in_bag
                prev_day_remaining_fruits = fruits - space_in_bag
        
            total_collection += fruits_collected

    
    print(total_collection)
    return

Valera_and_Fruits()  