n,t = gets.split.map(&:to_i)
a = Array.new(n){Array.new(3, 0)}
sum = 0
min_t = 100000
n.times do |i|
    a[i][0], a[i][1] = gets.split.map(&:to_i)
    a[i][2] = a[i][1]**10.to_f/a[i][0]
    min_t = a[i][0] if min_t>a[i][0]
end

a.sort!{|b,c| c[2] <=> b[2]}

while t>0 and !a.empty? do
    if t>min_t
        col = a[0]
    else
        col = a.max{|i, j| i[1] <=> j[1]}
    end
    sum += col[1]
    t -= col[0]
    a.shift
end

p sum

