type
  tlist = array [1..200000, 1..2] of longint;

var
  s: array [1..100000, 1..2] of longint;
  s1: tlist;
  k, ss: int64;
  i, n, s0, t: longint;
  f: text;

procedure qsort(var a: tlist);
  
  procedure sort(l, r: longint);
  var
    i, j, x, y: longint;
  begin
    i := l;
    j := r;
    x := a[(l + r) div 2, 1];
    repeat
      while a[i, 1] > x do
        inc(i);
      while x > a[j, 1] do
        dec(j);
      if not (i > j) then
      begin
        y := a[i, 1];
        a[i, 1] := a[j, 1];
        a[j, 1] := y;
        y := a[i, 2];
        a[i, 2] := a[j, 2];
        a[j, 2] := y;
        inc(i);
        j := j - 1;
      end;
    until i > j;
    if l < j then
      sort(l, j);
    if i < r then
      sort(i, r);
  end;

begin
  sort(1, t);
end;

begin
  assign(f, 'castle.in');
  reset(f);
  readln(f, n, s0);
  ss := 0;
  t := 0;
  for i := 1 to n do 
  begin
    read(f, s[i, 1], s[i, 2]);
    if s[i, 1] mod s[i, 2] > 0 then begin
      t := t + 1;
      s1[t, 1] := s[i, 1] mod s[i, 2];
      s1[t, 2] := 1;
    end;
    if s[i, 1] >= s[i, 2] then begin
      t := t + 1;
      s1[t, 1] := s[i, 2];
      s1[t, 2] := s[i, 1] div s[i, 2];
    end;
    k := k + s[i, 1];
  end;
  close(f);
  qsort(s1);
  i := 1;
  while (s0 > 0) and (i <= t) do 
  begin
    if s0 >= s1[i, 2] then begin
      k := k - (s1[i, 1] * s1[i, 2]);
      s0 := s0 - s1[i, 2];
    end
    else begin
      k := k - s1[i, 1] * s0;
      s0 := 0;
    end;
    i := i + 1;
  end;
  assign(f, 'castle.out');
  rewrite(f);
  writeln(f, k);
  close(f);
end.