N = gets.to_i
xu = N.times.map { gets.split.map(&:to_s) }
sumJPY = 0
sumBTC = 0
for y in 0..N - 1
  if xu[y][1] == 'JPY'
    sumJPY += xu[y][0].to_f
  elsif xu[y][1] == 'BTC'
    sumBTC += xu[y][0].to_f
  end
end
sumBTC = 380_000 * sumBTC
puts sumJPY + sumBTC