module mod_bounding_box
  implicit none
  real(8), parameter :: infty = 1.e12
  type :: bounding_box
    real(8) :: l(-1:1), r(-1:1)
  end type bounding_box
  private
  public :: infty
  public :: mins, maxs
  public :: bounding_box, init, add, get, event
contains
  subroutine mins(x,y)
    implicit none
    real(8), intent(inout) :: x
    real(8), intent(in) :: y
    x = min(x,y)
    return
  end subroutine mins
  subroutine maxs(x,y)
    implicit none
    real(8), intent(inout) :: x
    real(8), intent(in) :: y
    x = max(x,y)
    return
  end subroutine maxs
  subroutine init(bb)
    implicit none
    type(bounding_box), intent(inout) :: bb
    bb%l = infty
    bb%r = -infty
    return
  end subroutine init
  subroutine add(bb,z,i)
    implicit none
    type(bounding_box), intent(inout) :: bb
    real(8), intent(in) :: z
    integer :: i
    call mins(bb%l(i),z)
    call maxs(bb%r(i),z)
    return
  end subroutine add
  function get(bb,t) result(d)
    implicit none
    type(bounding_box), intent(in) :: bb
    real(8), intent(in) :: t
    real(8) :: d, l, r
    integer :: i
    l = infty
    r = -infty
    do i = -1, 1
      call mins(l,bb%l(i)+real(i,8)*t)
      call maxs(r,bb%r(i)+real(i,8)*t)
    end do
    d = r-l
    return
  end function get
  function event(bb) result(t)
    implicit none
    type(bounding_box), intent(in) :: bb
    real(8) :: t(6)
    t(1) = bb%l(-1)-bb%l(0)
    t(2) = 0.5d0*(bb%l(-1)-bb%l(1))
    t(3) = bb%l(0)-bb%l(1)
    t(4) = bb%r(-1)-bb%r(0)
    t(5) = 0.5d0*(bb%r(-1)-bb%r(1))
    t(6) = bb%r(0)-bb%r(1)
    return
  end function event
end module mod_bounding_box
program minimum_bounding_box
  use mod_bounding_box
  implicit none
  integer :: n, i
  real(8) :: x, y, ans, events(14)
  type(bounding_box) :: xbb, ybb
  character(1) :: d
  character(64) :: s
  call init(xbb)
  call init(ybb)
  events = 0.d0
  read(*,*) n
  do i = 1, n
    read(*,*) x, y, d
    select case(d)
    case("R")
      call add(xbb,x,1)
      call add(ybb,y,0)
    case("L")
      call add(xbb,x,-1)
      call add(ybb,y,0)
    case("U")
      call add(xbb,x,0)
      call add(ybb,y,1)
    case("D")
      call add(xbb,x,0)
      call add(ybb,y,-1)
    end select
  end do
  events(1:6) = event(xbb)
  events(7:12) = event(ybb)
  events(13) = 0.d0
  events(14) = infty
  ans = infty**3
  do i = 1, 14
    if (events(i).lt.0.d0) cycle
    call mins(ans,get(xbb,events(i))*get(ybb,events(i)))
  end do
  write(s,'(f40.16)') ans
  write(*,'(a)') trim(adjustl(s))
  stop
end program minimum_bounding_box