use std::io::prelude::*;

#[derive(Debug, Clone, Copy)]
struct Point {
    p: [i64; 2],
    d: Dir,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Dir {
    R = 0,
    L = 1,
    U = 2,
    D = 3,
}

impl std::str::FromStr for Dir {
    type Err = ();
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "R" => Ok(Dir::R),
            "L" => Ok(Dir::L),
            "U" => Ok(Dir::U),
            "D" => Ok(Dir::D),
            _ => unreachable!(),
        }
    }
}

#[derive(Debug, Clone, Copy)]
struct Range {
    min: i64,
    max: i64,
}

impl Range {
    fn from_points<'a, F: FnMut() -> T, T: Iterator<Item = &'a Point>>(
        mut pts: F,
        axis: usize,
    ) -> Option<Self> {
        let min = pts().map(|p| p.p[axis]).min();
        let max = pts().map(|p| p.p[axis]).max();

        if let (Some(min), Some(max)) = (min, max) {
            Some(Range { min: min, max: max })
        } else {
            None
        }
    }

    fn get_key_times(out: &mut Vec<i64>, ranges: &[Option<Range>; 3]) {
        // immobile - positive
        if let (Some(r1), Some(r2)) = (ranges[0], ranges[1]) {
            if r2.min < r1.min {
                out.push(r1.min - r2.min);
            }
            if r2.max < r1.max {
                out.push(r1.max - r2.max);
            }
        }
        // immobile - negative
        if let (Some(r1), Some(r2)) = (ranges[0], ranges[2]) {
            if r2.min > r1.min {
                out.push(r2.min - r1.min);
            }
            if r2.max > r1.max {
                out.push(r2.max - r1.max);
            }
        }
        // positive - negative
        if let (Some(r1), Some(r2)) = (ranges[1], ranges[2]) {
            if r1.min < r2.min {
                out.push((r2.min - r1.min) / 2);
            }
            if r1.max < r2.max {
                out.push((r2.max - r1.max) / 2);
            }
        }
    }

    fn union<F: FnMut() -> T, T: Iterator<Item = Range>>(mut ranges: F) -> Option<Self> {
        let min = ranges().map(|range| range.min).min();
        let max = ranges().map(|range| range.max).max();

        if let (Some(min), Some(max)) = (min, max) {
            Some(Range { min: min, max: max })
        } else {
            None
        }
    }

    fn translated_by(&self, x: i64) -> Self {
        Range {
            min: self.min + x,
            max: self.max + x,
        }
    }

    fn len(&self) -> i64 {
        self.max - self.min
    }
}

fn main() {
    let mut input_str = String::new();
    std::io::stdin().read_to_string(&mut input_str).unwrap();

    let input_parts = input_str.split_whitespace().collect::<Vec<_>>();
    let mut input_parts_it = input_parts.iter().cloned();

    let n: usize = input_parts_it.next().unwrap().parse().unwrap();

    let mut points: Vec<_> = (0..n)
        .map(|_| Point {
            p: [
                input_parts_it.next().unwrap().parse().unwrap(),
                input_parts_it.next().unwrap().parse().unwrap(),
            ],
            d: input_parts_it.next().unwrap().parse().unwrap(),
        })
        .collect();

    // Double the coordinates to easily handle fractional cases
    for p in points.iter_mut() {
        p.p[0] *= 2;
        p.p[1] *= 2;
    }

    let ranges = [
        // X
        [
            // Immobile
            Range::from_points(|| points.iter().filter(|p| (p.d as u8) >= 2), 0),
            // Positive
            Range::from_points(|| points.iter().filter(|p| p.d == Dir::R), 0),
            // Negative
            Range::from_points(|| points.iter().filter(|p| p.d == Dir::L), 0),
        ],
        // Y
        [
            // Immobile
            Range::from_points(|| points.iter().filter(|p| (p.d as u8) < 2), 1),
            // Positive
            Range::from_points(|| points.iter().filter(|p| p.d == Dir::U), 1),
            // Negative
            Range::from_points(|| points.iter().filter(|p| p.d == Dir::D), 1),
        ],
    ];

    let mut key_times = vec![0];

    Range::get_key_times(&mut key_times, &ranges[0]);
    Range::get_key_times(&mut key_times, &ranges[1]);

    let best = key_times
        .iter()
        .map(|&t| {
            let instant_ranges = [
                [
                    ranges[0][0],
                    ranges[0][1].map(|r| r.translated_by(t)),
                    ranges[0][2].map(|r| r.translated_by(-t)),
                ],
                [
                    ranges[1][0],
                    ranges[1][1].map(|r| r.translated_by(t)),
                    ranges[1][2].map(|r| r.translated_by(-t)),
                ],
            ];

            let aabb = [
                Range::union(|| instant_ranges[0].iter().filter_map(|r| r.clone())).unwrap(),
                Range::union(|| instant_ranges[1].iter().filter_map(|r| r.clone())).unwrap(),
            ];

            let area = aabb[0].len() * aabb[1].len();
            area
        })
        .min()
        .unwrap();

    println!("{}", best as f64 * 0.25);
}


Measured memory_bytes: 17652