Valera loves his garden, where n fruit trees grow.

This year he will enjoy a great harvest! On the i-th tree bi fruit grow, they will ripen on a day number ai. Unfortunately, the fruit on the tree get withered, so they can only be collected on day ai and day ai + 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?

Input

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 ai and bi (1 ≤ ai, bi ≤ 3000) — the day the fruits ripen on the i-th tree and the number of fruits on the i-th tree.

Output

Print a single integer — the maximum number of fruit that Valera can collect. 

Examples

Input

2 3
1 5
2 3


Output

8


Input

5 10
3 20
2 20
1 20
4 20
5 20


Output

60

Note

In the first sample, in order to obtain the optimal answer, you should act as follows. 

  * On the first day collect 3 fruits from the 1-st tree. 
  * On the second day collect 1 fruit from the 2-nd tree and 2 fruits from the 1-st tree. 
  * On the third day collect the remaining fruits from the 2-nd tree. 



In the second sample, you can only collect 60 fruits, the remaining fruit will simply wither.
import java.io.*;
import java.math.BigInteger;
import java.util.*;


 public class Main {
	public static InputReader in;
    public static PrintWriter pw;



	public static void main(String args[]) {
		new Thread(null, new Runnable() {
            public void run() {
                try{
                    solve();
                }
                catch(Exception e){
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();
    }
	static TreeSet<Integer> set;
	static ArrayList<Pair> g[];
	static boolean visited[];
	static long edje=0;
    static boolean vis[];
	static int parent[];
	static int col[];
	static boolean[] vis1;
	static int Ans=0;
	static int min=Integer.MAX_VALUE;
	static int val[];
	static int degree[];
	static int a[];
	static int f[];
	static  long total=0;
	static HashSet<String> s;
	static int distance[];
	public static void solve(){
	
		 in = new InputReader(System.in);
		 pw = new PrintWriter(System.out);
         int n=in.nextInt();
         int v=in.nextInt();
         int a[]=new int[3009];
         for(int i=0;i<n;i++)
         {
        	 int x=in.nextInt();
        	 int k=in.nextInt();
        	 a[x]+=k;
         }
         int ans=0;
         for(int i=1;i<3009;i++)
         {
        	 if(a[i]>v)
        	 {
        		 ans+=v;
        		 a[i]-=v;
        		 if(a[i]>v)
        			 a[i+1]+=v;
        		 else
        			 a[i+1]+=a[i];
        	 }
        	 else
        		 ans+=a[i];
         }
         System.out.println(ans);
     	}

	/*public static void dfs(int curr)
	{
		vis[curr]=true;
		int trees=0;
		for(int x:g[curr])
		{
			if(!vis[x]&&x!=1)
			{
			trees++;
			if(!s.contains(curr+" "+x))
				total+=cost[curr][x];
			dfs(x);
			}
	    }
		if(trees==0)
		{
			if(!s.contains(curr+" "+1))
				total+=cost[1][curr];
		}
	}
	public static void dfs1(int curr,int parent)
	{
	val[curr]=a[curr];
	for(int x:g[curr])
	{
	       if(x!=parent)
	       {
	    	   dfs1(x,curr);
	    	   val[curr]+=val[x];
	      }
	
	}
	}
	public static void dfs2(int curr,int parent)
	{
		f[curr]=val[curr];
		for(int x:g[curr])
		{
			if(x!=parent)
			{
				dfs2(x,curr);
				f[curr]+=f[x];
			}
		}
	}
	
	
	 
/*    public static void dfs2(int curr)
    {
    if(st[col[curr]].isEmpty())
    {
    ans[curr]=-1;	
    }
    else
    {
    	ans[curr]=st[col[curr]].peek();
    }
    st[col[curr]].push(curr);
    for(int x:g[curr])
    {
    	dfs2(x);
    }
    st[col[curr]].pop();
    	
    }
    
  
	public static void dfs1(int curr)
	{
		visited[curr]=true;
		for(int next:g[curr])
		{
			edje++;
			if(!visited[next])
				dfs1(next);
		}
	}
	
	public static void dfs(int curr,int prev)
		{
		val[curr]=1;
			for(int x:g[curr])
			{
				if(x!=prev)
				{
		            dfs(x,curr);
		            val[curr]+=val[x];
					
			    }
			}
		}*/
	
		public static long power(long a,long b)
		{
			long result=1;
			while(b>0)
			{
				if(b%2==1)
					result*=a;
				a=a*a;
				b/=2;
			}
			return result;
		}
				public static long pow(long n,long p,long m)
	{
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	}
	static class Pair implements Comparable<Pair>{
	int day1;
		int day2;
		int val;
		Pair(int mr,int i,int j){
	     	day1=mr;
	     	day2=i;
			val=j;
			
		}
		@Override
		public int compareTo(Pair o) {
		if(o.day1<this.day1)
		
			return 1;
			
			else 
				return -1;
			
			}
		
	}
	public static long gcd(long a, long b) {
		  if (b == 0) return a;
		  return gcd(b, a%b);
		}
	static class InputReader {
 
		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;
 
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
 
		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public   int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}
