program main
	implicit none
	integer :: N
	real(8), allocatable :: x(:)
	character(3), allocatable :: u(:)
	integer :: i
	real(8) :: Byen = 0.0d0, ans = 0.0d0
	
	read(*, *) N
	allocate(x(1:N), u(1:N))
	do i = 1, N
		read(*, *) x(i), u(i)
	end do
	
	do i = 1, N
		if(u(i) == "JPY" ) then
			ans = ans + x(i)
		else 
			Byen = Byen + x(i)
		end if
	end do
	ans = ans + 3.80d5 * Byen
	write(*, *) ans
end program main