program minimum_bounding_box
  implicit none
  integer :: n, i
  real(8) :: x, y, dx, dy
  real(8) :: nxmin, nxmax, nymin, nymax
  real(8) :: pxmin, pxmax, pymin, pymax
  real(8) :: sxmin, sxmax, symin, symax
  real(8) :: ans, tmp, t, tmax, tmin
  real(8), parameter :: tol = 1.e-14, dt = 1.e-6
  character(1) :: d
  character(64) :: s
  x = 0_8
  y = 0_8
  nxmin = 1.e10
  nxmax = -1.e10
  nymin = 1.e10
  nymax = -1.e10
  pxmin = 1.e10
  pxmax = -1.e10
  pymin = 1.e10
  pymax = -1.e10
  sxmin = 1.e10
  sxmax = -1.e10
  symin = 1.e10
  symax = -1.e10
  read(*,*) n
  do i = 1, n
    read(*,*) x, y, d
    dx = 0.d0
    dy = 0.d0
    select case(d)
    case("R")
      dx = 1.d0
    case("L")
      dx = -1.d0
    case("U")
      dy = 1.d0
    case("D")
      dy = -1.d0
    end select
    if (dx.eq.0.d0) then
      if (sxmin.gt.x) sxmin = x
      if (sxmax.lt.x) sxmax = x
    else
      if (symin.gt.y) symin = y
      if (symax.lt.y) symax = y
    end if
    if (dx.eq.1.d0) then
      if (pxmin.gt.x) pxmin = x
      if (pxmax.lt.x) pxmax = x
    else if (dx.eq.-1.d0) then
      if (nxmin.gt.x) nxmin = x
      if (nxmax.lt.x) nxmax = x
    end if
    if (dy.eq.1.d0) then
      if (pymin.gt.y) pymin = y
      if (pymax.lt.y) pymax = y
    else if (dy.eq.-1.d0) then
      if (nymin.gt.y) nymin = y
      if (nymax.lt.y) nymax = y
    end if
  end do
  ans = (max(nxmax,pxmax,sxmax)-min(nxmin,pxmin,sxmin))* &
  & (max(nymax,pymax,symax)-min(nymin,pymin,symin))
  tmax = max(max(nxmax,pxmax,sxmax)-min(nxmin,pxmin,sxmin), &
  & max(nymax,pymax,symax)-min(nymin,pymin,symin))
  tmax = 2.d0*tmax
  tmin = -tmax
  do while (tmax-tmin.gt.tol)
    t = 0.5d0*(tmax+tmin)
    tmp = (max(nxmax-(t+dt),pxmax+(t+dt),sxmax)-min(nxmin-(t+dt),pxmin+(t+dt),sxmin))* &
  & (max(nymax-(t+dt),pymax+(t+dt),symax)-min(nymin-(t+dt),pymin+(t+dt),symin)) - &
  & (max(nxmax-t,pxmax+t,sxmax)-min(nxmin-t,pxmin+t,sxmin))* &
  & (max(nymax-t,pymax+t,symax)-min(nymin-t,pymin+t,symin))
    if (tmp.lt.0.d0) then
      tmin = t
    else
      tmax = t
    end if
  end do
  t = 0.5d0*(tmax+tmin)
  ans = (max(nxmax-t,pxmax+t,sxmax)-min(nxmin-t,pxmin+t,sxmin))* &
  & (max(nymax-t,pymax+t,symax)-min(nymin-t,pymin+t,symin))
  write(s,'(f40.16)') ans
  write(*,'(a)') trim(adjustl(s))
  stop
end program minimum_bounding_box