a = gets.to_i

b = []
jpy = 0
btc = 0
a.times.each do |i|
  b << gets.split(" ").map(&:to_s)

  if b[i][1] == 'JPY'
    jpy += b[i][0].to_i
  else
    btc += b[i][0].to_f
  end
end

#puts btc * 380000.0.to_i

puts "#{jpy + btc * 380000.0.to_i}"