def input
  gets.chomp.split(' ').map(&:to_i)
end

storesNum, wantNum = input
list = []
storesNum.times do |i|
  count, price = input
  count.times {|c| list.push(price)}
end

print(list.sort.take(wantNum).inject(:+))