def r;gets.split.map &:to_i;end
def rr(n);n.times{yield gets.chomp.split};end
N = gets.to_i
R = 380000
count = 0
rr(N) do |x,u|
  case u
  when "JPY"
    count += x.to_i
  when "BTC"
    count += x.to_f * R
  end
end
puts count
