#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a;
}
int sub(int a, int b) {
  if ((a -= b) < P) a += P;
  return a;
}
int mul(int a, int b) { return 1ll * a * b % P; }
int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = 202020;
int n;
map<char, bool> a[N];
map<char, int> dx, dy;
pair<int, int> calc(char u, char v, char w) {
  int x = 0, y = 0;
  for (int i = (1); i < (n + 1); i++) {
    if (a[i][u])
      x += dx[u], y += dy[u];
    else if (a[i][v])
      x += dx[v], y += dy[v];
    else
      x += dx[w], y += dy[w];
  }
  return make_pair(x, y);
}
int calc(pair<int, int> x, pair<int, int> y) {
  int dx = y.first - x.first, dy = y.second - x.second;
  long long t = (1ll * dx * dx + 1ll * dy * dy) / 2;
  return sqrt(t);
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n;
  for (int i = (1); i < (n + 1); i++) {
    string s;
    cin >> s;
    for (int j = (0); j < ((int)s.size()); j++) a[i][s[j]] = 1;
  }
  dx['L'] = dy['D'] = -1;
  dx['R'] = dy['U'] = 1;
  vector<pair<int, int> > r;
  r.push_back(calc('U', 'L', 'R'));
  r.push_back(calc('R', 'U', 'D'));
  r.push_back(calc('D', 'L', 'R'));
  r.push_back(calc('L', 'U', 'D'));
  int x = calc(r[0], r[1]), y = calc(r[1], r[2]);
  cout << (x + 1) * 1ll * (y + 1) << "\n";
  return 0;
}
