program bbb
implicit none

integer :: n, i
real(8) :: res
real(8),allocatable,dimension(:) :: x
character(3),allocatable,dimension(:) :: u

read*, n
allocate(x(n),u(n))

do i=1, n
read*, x(i), u(i)
end do

res=0

do i=1,n
if(u(i)=='JPY') then
res=res+x(i)
else
res=res+x(i)*380000
end if
end do

write(*,*) res

end program