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: Accepted)

#include <iostream>
#include <limits>
#include <cfenv>
#include <cmath>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <tuple>
#include <queue>
#include <vector>
#include <cmath>
#include <random>
#include <math.h>
#include <list>
#include <random>
#include <functional>


#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

using lli = long long int;
using pii = std::pair<int, int>;

template <class T> inline bool chmax(T& a, T b){
    if(a < b){a = b; return true;}
    return false;
}
template <class T> inline bool chmin(T& a, T b){
    if(a > b){a = b; return true;}
    return false;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


constexpr long double EPS = 1e-8;
constexpr int inf = 2e9;
constexpr std::pair<int, int> id(inf, -inf);
std::array<std::pair<int, int>, 3> X{id, id, id}, Y{id, id, id};

void update(std::pair<int, int>& p, int v){
    if(p.first > v) p.first = v;
    if(p.second < v) p.second = v;
}

long double area(long double t){
    long double xmin = X[2].first, xmax = X[2].second;
    long double ymin = Y[2].first, ymax = Y[2].second;
    if(X[0].first  + t < xmin) xmin = X[0].first  + t;
    if(X[0].second + t > xmax) xmax = X[0].second + t;
    if(X[1].first  - t < xmin) xmin = X[1].first  - t;
    if(X[1].second - t > xmax) xmax = X[1].second - t;

    if(Y[0].first  + t < ymin) ymin = Y[0].first  + t;
    if(Y[0].second + t > ymax) ymax = Y[0].second + t;
    if(Y[1].first  - t < ymin) ymin = Y[1].first  - t;
    if(Y[1].second - t > ymax) ymax = Y[1].second - t;
    if(std::abs(xmax - xmin) < EPS) return 0;
    if(std::abs(ymax - ymin) < EPS) return 0;
    return (xmax - xmin) * (ymax - ymin);
}

void upd(long double& res, int x1, int x2, int p1, int p2){
    if(p1 == p2) return;
    long double t = (x2 - x1); t /= (p1 - p2);
    if(t < 0) return;
    long double S = area(t);
    if(res > S) res = S;
}

int main(void){
    int n; scanf("%d", &n);
    REP(i, n){
        int x, y; char c; scanf("%d%d %c", &x, &y, &c);
        switch (c)
        {
        case 'R':
            update(X[0], x);
            update(Y[2], y);
            break;
        case 'L':
            update(X[1], x);
            update(Y[2], y);
            break;
        case 'U':
            update(Y[0], y);
            update(X[2], x);
            break;
        case 'D':
            update(Y[1], y);
            update(X[2], x);
            break;
        }
    }
    long double res = area(0);
    upd(res, X[0].first,  X[1].first,  1, -1);
    upd(res, X[0].second, X[1].second, 1, -1);
    upd(res, Y[0].first,  Y[1].first,  1, -1);
    upd(res, Y[0].second, Y[1].second, 1, -1);
  
    upd(res, X[0].first,  X[2].first,  1, 0);
    upd(res, X[0].second, X[2].second, 1, 0);
    upd(res, Y[0].first,  Y[2].first,  1, 0);
    upd(res, Y[0].second, Y[2].second, 1, 0);
  
    upd(res, X[1].first,  X[2].first,  -1, 0);
    upd(res, X[1].second, X[2].second, -1, 0);
    upd(res, Y[1].first,  Y[2].first,  -1, 0);
    upd(res, Y[1].second, Y[2].second, -1, 0);
    printf("%.16Lf\n", res);

    

    return 0;
}