N = gets.to_i
@ls = []
N.times do
  @ls << gets.split
end
 
btc_amount = @ls.select{ |price, unit| unit == 'BTC' }.map{ |price, _| price.to_f }.inject(:+)
jpy_amount = @ls.select{ |price, unit| unit == 'JPY' }.map{ |price, _| price.to_i }.inject(:+)
 
if btc_amount.nil?
  puts  jpy_amount
elsif jpy_amount.nil?
  puts btc_amount.to_f * 380000
elsif !!jpy_amount && !!btc_amount
  puts btc_amount.to_f * 380000 + jpy_amount
end