program minimum_bounding_box
  implicit none
  integer :: n, i
  real(8) :: p(100000,4), dx0, dy0, dx1, dy1
  real(8) :: ans, tmp, t, tmin, tmax
  real(8), parameter :: tol = 1.e-14, dt = 1.e-3
  logical :: mininc, maxinc, midinc
  character(1) :: d
  character(64) :: s
  p = 0.d0
  read(*,*) n
  do i = 1, n
    read(*,*) p(i,1:2), d
    select case(d)
    case("R")
      p(i,3) = 1.d0
    case("L")
      p(i,3) = -1.d0
    case("U")
      p(i,4) = 1.d0
    case("D")
      p(i,4) = -1.d0
    end select
  end do
  tmin = 0.d0
  tmax = 1.e18
  dx0 = maxval(p(1:n,1))-minval(p(1:n,1))
  dy0 = maxval(p(1:n,2))-minval(p(1:n,2))
  dx1 = maxval(p(1:n,1)+dt*p(1:n,3))-minval(p(1:n,1)+dt*p(1:n,3))
  dy1 = maxval(p(1:n,2)+dt*p(1:n,4))-minval(p(1:n,2)+dt*p(1:n,4))
  mininc = (dx1*dy1-dx0*dy0.ge.0.d0)
  t = tmax
  dx0 = maxval(p(1:n,1)+t*p(1:n,3))-minval(p(1:n,1)+t*p(1:n,3))
  dy0 = maxval(p(1:n,2)+t*p(1:n,4))-minval(p(1:n,2)+t*p(1:n,4))
  dx1 = maxval(p(1:n,1)+(t+dt)*p(1:n,3))-minval(p(1:n,1)+(t+dt)*p(1:n,3))
  dy1 = maxval(p(1:n,2)+(t+dt)*p(1:n,4))-minval(p(1:n,2)+(t+dt)*p(1:n,4))
  maxinc = (dx1*dy1-dx0*dy0.ge.0.d0)
  if (mininc.eqv.maxinc) then
    dx0 = maxval(p(1:n,1))-minval(p(1:n,1))
    dy0 = maxval(p(1:n,2))-minval(p(1:n,2))
    ans = dx0*dy0
    write(s,'(f40.16)') ans
    write(*,'(a)') trim(adjustl(s))
    stop
  end if
  do while (tmax-tmin.gt.tol)
    t = 0.5d0*(tmax+tmin)
    dx0 = maxval(p(1:n,1)+t*p(1:n,3))-minval(p(1:n,1)+t*p(1:n,3))
    dy0 = maxval(p(1:n,2)+t*p(1:n,4))-minval(p(1:n,2)+t*p(1:n,4))
    dx1 = maxval(p(1:n,1)+(t+dt)*p(1:n,3))-minval(p(1:n,1)+(t+dt)*p(1:n,3))
    dy1 = maxval(p(1:n,2)+(t+dt)*p(1:n,4))-minval(p(1:n,2)+(t+dt)*p(1:n,4))
    midinc = (dx1*dy1-dx0*dy0.ge.0.d0)
    if (midinc.eqv.mininc) then
      tmin = t
    else
      tmax = t
    end if
  end do
  t = 0.5d0*(tmax+tmin)
  dx0 = maxval(p(1:n,1)+t*p(1:n,3))-minval(p(1:n,1)+t*p(1:n,3))
  dy0 = maxval(p(1:n,2)+t*p(1:n,4))-minval(p(1:n,2)+t*p(1:n,4))
  ans = dx0*dy0
  write(s,'(f40.16)') ans
  write(*,'(a)') trim(adjustl(s))
  stop
end program minimum_bounding_box