n = gets.to_i
sum = Hash.new(0)
while o = gets do
    v,k = o.split(" ")
    v = v.to_f
    k = k.to_s
    sum[k] += v
end

total = 0
sum.each do |k,v|
    if k == "JPY"
        total = total + v.to_f
    elsif k == "BTC"
        total = total + (v.to_f*380000.0)
    end
end

puts total