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 <bits/stdc++.h>

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    vector<char> d(n);
    REP(i, n) cin >> x[i] >> y[i] >> d[i];

    vector<ll> xmi(4, LLINF), ymi(4, LLINF), xma(4, -LLINF), yma(4, -LLINF);
    REP(i, n) {
        if(d[i]=='L') {
            chmin(xmi[0], x[i]);
            chmin(ymi[0], y[i]);
            chmax(yma[0], x[i]);
            chmax(yma[0], y[i]);
        } else if(d[i]=='R') {
            chmin(xmi[1], x[i]);
            chmin(ymi[1], y[i]);
            chmax(xma[1], x[i]);
            chmax(yma[1], y[i]);
        } else if(d[i]=='U') {
            chmin(xmi[2], x[i]);
            chmin(ymi[2], y[i]);
            chmax(xma[2], x[i]);
            chmax(yma[2], y[i]);
        } else if(d[i]=='D') {
            chmin(xmi[3], x[i]);
            chmin(ymi[3], y[i]);
            chmax(xma[3], x[i]);
            chmax(yma[3], y[i]);
        }
    }

    vector<double> t;
    t.push_back(0);
    REP(i, 4) FOR(j, i+1, 4) {
        t.push_back(abs(ymi[i]-ymi[j]) / 2.0);
        t.push_back(abs(yma[i]-yma[j]) / 2.0);
        t.push_back(abs(ymi[i]-ymi[j]));
        t.push_back(abs(yma[i]-yma[j]));
        t.push_back(abs(xmi[i]-xmi[j]) / 2.0);
        t.push_back(abs(xma[i]-xma[j]) / 2.0);
        t.push_back(abs(xmi[i]-xmi[j]));
        t.push_back(abs(xma[i]-xma[j]));
    }

    double ans = LLINF;
    for(auto i: t) {
        // i秒後について
        double xmin = LLINF, xmax = -LLINF, ymin = LLINF, ymax = -LLINF;
        REP(j, n) {
            double nx = x[j], ny = y[j];
            if(d[j]=='L') nx -= i;
            else if(d[j]=='R') nx += i;
            else if(d[j]=='U') ny += i;
            else if(d[j]=='D') ny -= i;
            chmin(xmin, nx), chmin(ymin, ny);
            chmax(xmax, nx), chmax(ymax, ny);
        }
        chmin(ans, (xmax-xmin)*(ymax-ymin));
    }
    cout << fixed << setprecision(15) << ans << endl;

    return 0;
}