Problem:
Score : 600 points

Problem Statement

There are N points in a two-dimensional plane. The initial coordinates of the i-th point are (x_i, y_i). Now, each point starts moving at a speed of 1 per second, in a direction parallel to the x- or y- axis. You are given a character d_i that represents the specific direction in which the i-th point moves, as follows:

If d_i = R, the i-th point moves in the positive x direction;

If d_i = L, the i-th point moves in the negative x direction;

If d_i = U, the i-th point moves in the positive y direction;

If d_i = D, the i-th point moves in the negative y direction.

You can stop all the points at some moment of your choice after they start moving (including the moment they start moving).
Then, let x_{max} and x_{min} be the maximum and minimum among the x-coordinates of the N points, respectively. Similarly, let y_{max} and y_{min} be the maximum and minimum among the y-coordinates of the N points, respectively.

Find the minimum possible value of (x_{max} - x_{min}) \times (y_{max} - y_{min}) and print it.

Constraints

1 \leq N \leq 10^5

-10^8 \leq x_i,\ y_i \leq 10^8

x_i and y_i are integers.

d_i is R, L, U, or D.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1 d_1
x_2 y_2 d_2
.
.
.
x_N y_N d_N

Output

Print the minimum possible value of (x_{max} - x_{min}) \times (y_{max} - y_{min}).

The output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-9}.

Sample Input 1

2
0 3 D
3 0 L

Sample Output 1

0

After three seconds, the two points will meet at the origin. The value in question will be 0 at that moment.

Sample Input 2

5
-7 -10 U
7 -6 U
-8 7 D
-3 3 D
0 -6 R

Sample Output 2

97.5

The answer may not be an integer.

Sample Input 3

20
6 -10 R
-4 -9 U
9 6 D
-3 -2 R
0 7 D
4 5 D
10 -10 U
-1 -8 U
10 -6 D
8 -5 U
6 4 D
0 3 D
7 9 R
9 -4 R
3 10 D
1 9 U
1 -6 U
9 -8 R
6 7 D
7 -3 D

Sample Output 3

273

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<functional>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

double const INF = 1e18;
struct range { 
  double ma, mi;
  range(): ma(-INF), mi(INF) {}
  range(double hi, double lo): ma(hi), mi(lo) {}
  void update(double v) {
    ma = std::max(ma, v);
    mi = std::min(mi, v);
  }
void print() const { std::cout << "[" << mi << ", " << ma << "]\n"; }
};

void add_time(std::vector<double>& ts, range r[3]) {
  auto add_one = [&](std::vector<double>& t, double v)->void { if(v >= 0 && v <= 2e8) t.push_back(v); };
  //up to stop;
  add_one(ts, r[1].ma - r[2].ma);
  add_one(ts, r[1].ma - r[2].mi);
  add_one(ts, r[1].mi - r[2].ma);
  add_one(ts, r[1].mi - r[2].mi);
  //down to stop;
  add_one(ts, r[0].ma - r[1].ma);
  add_one(ts, r[0].ma - r[1].mi);
  add_one(ts, r[0].mi - r[1].ma);
  add_one(ts, r[0].mi - r[1].mi);
  // up to down
  add_one(ts, (r[0].ma - r[2].ma)*0.5);
  add_one(ts, (r[0].ma - r[2].mi)*0.5);
  add_one(ts, (r[0].mi - r[2].ma)*0.5);
  add_one(ts, (r[0].mi - r[2].mi)*0.5);
}

int main() {
  std::cout << std::setprecision(10) << std::fixed;
  int N; std::cin >> N;
  range x[3], y[3]; // 0:dec, 1:stop, 2:inc
  for(int i = 0; i < N; ++i) {
    double xx, yy; char d; std::cin >> xx >> yy >> d;
    switch(d) {
    case 'R': x[2].update(xx); y[1].update(yy); break;
    case 'L': x[0].update(xx); y[1].update(yy); break;
    case 'U': x[1].update(xx); y[2].update(yy); break;
    case 'D': x[1].update(xx); y[0].update(yy); break;
    }
  }
  std::vector<double> ts(1, 0);
  add_time(ts, x);
  add_time(ts, y);
  std::sort(ts.begin(), ts.end());
  ts.erase(std::unique(ts.begin(), ts.end()), ts.end());
  auto f = [&](double t) {
    auto calc = [](double t, range r[3]) {
      double ma = r[1].ma, mi = r[1].mi;
      ma = std::max(ma, r[0].ma - t);
      ma = std::max(ma, r[2].ma + t);
      mi = std::min(mi, r[0].mi - t);
      mi = std::min(mi, r[2].mi + t);
      return ma - mi;
    };
    return calc(t, x)*calc(t, y);
  };
  
  double ans = INF;
  for(int t: ts) ans = std::min(ans, f(t));
  fin(ans);
  return 0;
}