read N
ans=0
for ((i=0; i<N; i++)); do
    read x y
    if [[ $y == 'JPY' ]]; then
        ans=$(echo $ans $x | awk '$0+=$2')
    else
        ans=$(echo $ans $x | awk '$0+=$2*38e4')
    fi
done

echo $ans