N = gets.to_i

h = []
N.times do |i|
  x_i, u_i = gets.split.map(&:to_s)
  h << {"#{u_i}": x_i.to_f }
end

t = h.flat_map(&:to_a).each_with_object(Hash.new(0)) {|(k, v), h| h[k] += v}
puts t[:JPY] + t[:BTC]*380000