Scanf.scanf "%d" (fun n ->
    let rec loop i acc =
        if i = n then acc else
            let acc = Scanf.scanf " %f %s" (fun x u ->
                if u = "JPY" then acc +. x else acc +. x *. 380000.
            )
            in
            loop (i + 1) acc
    in
    loop 0 0. |> Printf.printf "%f\n"
)