const BKRT = "\n";
const SPAC = " ";
const NOSP = "";

function Main(input){
	input = input.split(BKRT).map(a=>a.split(SPAC));
  const strShift = ()=>{
  	var a = input.shift();
    	var b = a.shift();
    	if(a.length)input.unshift(a);
      return b;
  }
  const intShift = ()=>~~strShift();
  
  var N = intShift();
  var M = intShift();
  input.sort((a,b)=>a[0]-b[0]);
  
  var sum = 0;
  for(var i = 0; i < N ; i++){
  	var a = input[i];
    
    var b = Math.min(M,a[1]);
    sum += b * a[0];
    M -= b;
    
    if(M == 0)return ~~sum;
  }
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
4 30
6 18
2 5
3 10
7 9
`);
