Problem: Limak is a little polar bear. His parents told him to clean a house before the New Year's Eve. Their house is a rectangular grid with h rows and w columns. Each cell is an empty square.

He is a little bear and thus he can't clean a house by himself. Instead, he is going to use a cleaning robot.

A cleaning robot has a built-in pattern of n moves, defined by a string of the length n. A single move (character) moves a robot to one of four adjacent cells. Each character is one of the following four: 'U' (up), 'D' (down), 'L' (left), 'R' (right). One move takes one minute.

A cleaning robot must be placed and started in some cell. Then it repeats its pattern of moves till it hits a wall (one of four borders of a house). After hitting a wall it can be placed and used again.

Limak isn't sure if placing a cleaning robot in one cell will be enough. Thus, he is going to start it w·h times, one time in each cell. Maybe some cells will be cleaned more than once but who cares?

Limak asks you one question. How much time will it take to clean a house? Find and print the number of minutes modulo 109 + 7. It's also possible that a cleaning robot will never stop — then print "-1" (without the quotes) instead.

Placing and starting a robot takes no time, however, you must count a move when robot hits a wall. Take a look into samples for further clarification.

Input

The first line contains three integers n, h and w (1 ≤ n, h, w ≤ 500 000) — the length of the pattern, the number of rows and the number of columns, respectively.

The second line contains a string of length n — the pattern of n moves. Each character is one of uppercase letters 'U', 'D', 'L' or 'R'.

Output

Print one line with the answer.

If a cleaning robot will never stop, print "-1" (without the quotes). Otherwise, print the number of minutes it will take to clean a house modulo 109 + 7.

Examples

Input

1 10 2
R


Output

30


Input

3 4 6
RUL


Output

134


Input

4 1 500000
RLRL


Output

-1

Note

In the first sample house is a grid with 10 rows and 2 columns. Starting a robot anywhere in the second column will result in only one move (thus, one minute of cleaning) in which robot will hit a wall — he tried to go right but there is no third column. Starting a robot anywhere in the first column will result in two moves. The total number of minutes is 10·1 + 10·2 = 30.

In the second sample a started robot will try to move "RULRULRULR..." For example, for the leftmost cell in the second row robot will make 5 moves before it stops because of hitting an upper wall.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
long long min(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << ", ";
  err(++it, args...);
}
template <typename T>
struct number_iterator : std::iterator<random_access_iterator_tag, T> {
  T v;
  number_iterator(T _v) : v(_v) {}
  operator T&() { return v; }
  T operator*() const { return v; }
};
template <typename T>
struct number_range {
  T b, e;
  number_range(T b, T e) : b(b), e(e) {}
  number_iterator<T> begin() { return b; }
  number_iterator<T> end() { return e; }
};
template <typename T>
number_range<T> range(T e) {
  return number_range<T>(1, e + 1);
}
template <typename T>
number_range<T> range(T b, T e) {
  return number_range<T>(b, e + 1);
}
int n, w, h;
string x;
int dx[5] = {0, -1, 0, 1}, dy[5] = {-1, 0, 1, 0};
int a[600001];
char z[5] = {'L', 'U', 'R', 'D'};
long long res = 0;
int u, b, l, r;
struct E {
  int t;
  int dir;
  E() {}
  E(int t, int dir) : t(t), dir(dir) {}
};
long long bigmod(long long a, long long p) {
  if (p == 1) return a;
  if (!p) return 1;
  long long t = bigmod(a, p >> 1);
  t = t * t % 1000000007;
  if (p & 1) t = t * a % 1000000007;
  return t;
}
bool operator<(E u, E v) { return u.t > v.t; }
priority_queue<E> Q;
vector<E> T;
vector<E> TY[5];
int main() {
  scanf("%d%d%d", &n, &h, &w);
  cin >> x;
  for (int i = (1); i <= (n); i++) {
    for (int j = (0); j <= (3); j++)
      if (z[j] == x[i - 1]) a[i] = j;
  }
  u = b = l = r = 0;
  int cx = 0, cy = 0;
  long long survive = (long long)h * w;
  long long hh = h;
  long long ww = w;
  for (int i = (1); i <= (n); i++) {
    res = (res + survive) % 1000000007;
    cx += dx[a[i]];
    cy += dy[a[i]];
    if (u > cx || b < cx || l > cy || r < cy) {
      Q.push(E(i, a[i]));
      TY[a[i]].push_back(E(i, a[i]));
      if (u > cx || b < cx) {
        survive -= ww;
        hh--;
      } else {
        survive -= hh;
        ww--;
      }
    }
    if (ww == 0 || hh == 0) {
      cout << res << endl;
      return 0;
    }
    u = min(u, cx);
    b = max(b, cx);
    l = min(l, cy);
    r = max(r, cy);
  }
  while (Q.size()) {
    T.push_back(Q.top());
    Q.pop();
  }
  if (cx == 0 && cy == 0 && (r - l + 1) <= w && (b - u + 1) <= h) {
    puts("-1");
    return 0;
  } else {
    if (cx < 0) {
      int cnt = (cx - u);
      for (int i = (0); i < (TY[1].size()); i++)
        if (i >= cnt) Q.push(TY[1][i]);
    }
    if (cx > 0) {
      int cnt = (b - cx);
      for (int i = (0); i < (TY[3].size()); i++)
        if (i >= cnt) Q.push(TY[3][i]);
    }
    if (cy > 0) {
      int cnt = (r - cy);
      for (int i = (0); i < (TY[2].size()); i++)
        if (i >= cnt) Q.push(TY[2][i]);
    }
    if (cy < 0) {
      int cnt = (cy - l);
      for (int i = (0); i < (TY[0].size()); i++)
        if (i >= cnt) Q.push(TY[0][i]);
    }
    survive %= 1000000007;
    long long curt = 0;
    while (T.size()) T.pop_back();
    while (Q.size()) {
      T.push_back(Q.top());
      Q.pop();
    }
    int dh = 0, dw = 0;
    for (auto Z : T) {
      if (Z.dir == 0 || Z.dir == 2)
        dw++;
      else
        dh++;
    }
    long long k;
    if (!dw)
      k = hh / dh;
    else if (!dh)
      k = ww / dw;
    else
      k = min(hh / dh, ww / dw);
    int dh2 = 0, dw2 = 0;
    for (auto Z : T) {
      if (Z.dir == 0 || Z.dir == 2) {
        long long h2 = hh - dh2;
        long long s1 = (Z.t) % 1000000007;
        long long s2 = (k * h2) % 1000000007;
        long long k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * dh % 1000000007;
        s2 = (s2 + 1000000007 - k1) % 1000000007;
        s2 = s2 * s1 % 1000000007;
        k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * h2 % 1000000007;
        long long k2 = k - 1;
        k2 = k2 * (k2 + 1) % 1000000007 * (2 * k2 + 1) % 1000000007 *
             bigmod(6, 1000000007 - 2) % 1000000007;
        k2 = k2 * dh % 1000000007;
        k1 = (k1 + 1000000007 - k2) % 1000000007 * n % 1000000007;
        res = (res + s2 + k1) % 1000000007;
        dw2++;
      } else {
        long long w2 = ww - dw2;
        long long s1 = (Z.t) % 1000000007;
        long long s2 = (k * w2) % 1000000007;
        long long k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * dw % 1000000007;
        s2 = (s2 + 1000000007 - k1) % 1000000007;
        s2 = s2 * s1 % 1000000007;
        k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * w2 % 1000000007;
        long long k2 = k - 1;
        k2 = k2 * (k2 + 1) % 1000000007 * (2 * k2 + 1) % 1000000007 *
             bigmod(6, 1000000007 - 2) % 1000000007;
        k2 = k2 * dw % 1000000007;
        k1 = (k1 + 1000000007 - k2) % 1000000007 * n % 1000000007;
        res = (res + s2 + k1) % 1000000007;
        dh2++;
      }
    }
    int now = 0;
    ww -= k * dw;
    hh -= k * dh;
    survive = ww * hh % 1000000007;
    long long ct = k * n % 1000000007;
    res = (res + (survive * ct) % 1000000007) % 1000000007;
    while (ww && hh) {
      res = (res + (survive * (T[now].t - curt)) % 1000000007) % 1000000007;
      curt = T[now].t;
      if (T[now].dir == 0 || T[now].dir == 2) {
        survive = (survive + 1000000007 - hh) % 1000000007;
        ww--;
      } else {
        survive = (survive + 1000000007 - ww) % 1000000007;
        hh--;
      }
      now++;
      if (now == T.size()) {
        now -= T.size();
        curt -= n;
      }
    }
    cout << res << endl;
  }
  return 0;
}