module Array = ArrayLabels

let inf = 1000000000.0

let (>>=) x f = List.map f x |> List.concat

let () =
  Scanf.scanf "%d" @@ fun n ->
  let xyds = Array.init n (fun _ -> Scanf.scanf " %f %f %s" (fun x y d -> x, y, d)) in
  let area_of_time (t : float) =
    let xm, xM, ym, yM =
      Array.fold_left xyds ~init:(inf, -.inf, inf, -.inf) ~f:(fun (xm,xM,ym,yM) (x,y,d) ->
        let x, y =
          match d with
          | "R" -> (x +. t, y)      | "L" -> (x -. t, y)
          | "U" -> (x,      y +. t) | _   -> (x,      y -. t)
        in
        (min xm x, max xM x, min ym y, max yM y))
    in
    (xM -. xm) *. (yM -. ym)
  in
  let find_edges axis dir =
    Array.fold_left xyds ~init:(inf, -.inf) ~f:(fun (minv, maxv) (x, y, d) ->
      let v = match axis with `X -> x | `Y -> y in
      if d = dir then (min minv v, max maxv v) else (minv, maxv))
    |> fun (a, b) -> [a; b]
  in
  let events =
    List.map (fun axis -> ["L"; "R"; "U"; "D"] >>= find_edges axis) [`X; `Y]
    |> List.concat
  in

  (events >>= fun t1 ->
   events >>= fun t2 ->
     [min (area_of_time @@ abs_float (t1 -. t2)) (area_of_time @@ abs_float (t1 -. t2) /. 2.)])
  |> List.fold_left min inf
  |> Printf.printf "%.11f\n"
