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;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
template <class T>
inline void read(T &n) {
  char c;
  int flag = 1;
  for (c = getchar(); !(c >= '0' && c <= '9' || c == '-'); c = getchar())
    ;
  if (c == '-')
    flag = -1, n = 0;
  else
    n = c - '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';
  n *= flag;
}
const int maxn = 2000000;
const long long mo = 1000000007;
int K, N, M, x[maxn], y[maxn];
char step[maxn];
long long calc(int lx1, int rx1, int ly1, int ry1, int lx2, int rx2, int ly2,
               int ry2, int lx3, int rx3, int ly3, int ry3, int dx, int dy) {
  long long ret = inf;
  for (int i = (1); i <= (K); ++i) {
    lx1 = max(lx1, 1 - x[i]);
    ly1 = max(ly1, 1 - y[i]);
    rx1 = min(rx1, N - x[i]);
    ry1 = min(ry1, M - y[i]);
    lx2 = max(lx2, 1 - (x[i] + dx));
    ly2 = max(ly2, 1 - (y[i] + dy));
    rx2 = min(rx2, N - (x[i] + dx));
    ry2 = min(ry2, M - (y[i] + dy));
    lx3 = max(lx3, 1 - (x[i] + dx * 2));
    ly3 = max(ly3, 1 - (y[i] + dy * 2));
    rx3 = min(rx3, N - (x[i] + dx * 2));
    ry3 = min(ry3, M - (y[i] + dy * 2));
    long long curx = rx1 - lx1 + 1, cury = ry1 - ly1 + 1;
    curx = rx2 - lx2 + 1, cury = ry2 - ly2 + 1;
    if (curx > 0 && cury > 0) {
      long long sx = curx - (rx3 - lx3 + 1);
      long long sy = cury - (ry3 - ly3 + 1);
      if (sx) ret = min(ret, curx / sx);
      if (sy) ret = min(ret, cury / sy);
    }
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &K, &N, &M);
  scanf("%s", step + 1);
  for (int i = (K + 1); i <= (3 * K); ++i) step[i] = step[i - K];
  int minx = 0, maxx = 0, miny = 0, maxy = 0;
  int lx = 1, rx = N, ly = 1, ry = M;
  for (int i = (1); i <= (K); ++i) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    if (step[i] == 'L')
      --y[i];
    else if (step[i] == 'R')
      ++y[i];
    else if (step[i] == 'U')
      --x[i];
    else
      ++x[i];
    minx = min(minx, x[i]);
    maxx = max(maxx, x[i]);
    miny = min(miny, y[i]);
    maxy = max(maxy, y[i]);
    lx = max(lx, 1 - x[i]);
    ly = max(ly, 1 - y[i]);
    rx = min(rx, N - x[i]);
    ry = min(ry, M - y[i]);
  }
  if (maxx - minx + 1 <= N && maxy - miny + 1 <= M && x[K] == 0 && y[K] == 0) {
    puts("-1");
    return 0;
  }
  int lx1 = 1, rx1 = N, ly1 = 1, ry1 = M;
  int lx2 = lx, rx2 = rx, ly2 = ly, ry2 = ry;
  for (int i = (K + 1); i <= (2 * K); ++i) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    if (step[i] == 'L')
      --y[i];
    else if (step[i] == 'R')
      ++y[i];
    else if (step[i] == 'U')
      --x[i];
    else
      ++x[i];
    lx = max(lx, 1 - x[i]);
    ly = max(ly, 1 - y[i]);
    rx = min(rx, N - x[i]);
    ry = min(ry, M - y[i]);
  }
  int lx3 = lx, rx3 = rx, ly3 = ly, ry3 = ry;
  int dx = x[K], dy = y[K];
  long long lim = 1 + calc(lx1, rx1, ly1, ry1, lx2, rx2, ly2, ry2, lx3, rx3,
                           ly3, ry3, dx, dy);
  long long ans = (long long)N * M % mo;
  for (int i = (1); i <= (K); ++i) {
    lx1 = max(lx1, 1 - x[i]);
    ly1 = max(ly1, 1 - y[i]);
    rx1 = min(rx1, N - x[i]);
    ry1 = min(ry1, M - y[i]);
    lx2 = max(lx2, 1 - (x[i] + dx));
    ly2 = max(ly2, 1 - (y[i] + dy));
    rx2 = min(rx2, N - (x[i] + dx));
    ry2 = min(ry2, M - (y[i] + dy));
    lx3 = max(lx3, 1 - (x[i] + dx * 2));
    ly3 = max(ly3, 1 - (y[i] + dy * 2));
    rx3 = min(rx3, N - (x[i] + dx * 2));
    ry3 = min(ry3, M - (y[i] + dy * 2));
    long long curx = rx1 - lx1 + 1, cury = ry1 - ly1 + 1;
    if (curx > 0 && cury > 0)
      ans += curx * cury, ans %= mo;
    else
      break;
    curx = rx2 - lx2 + 1, cury = ry2 - ly2 + 1;
    if (curx > 0 && cury > 0) {
      long long sx = curx - (rx3 - lx3 + 1);
      long long sy = cury - (ry3 - ly3 + 1);
      if (sx) lim = min(lim, curx / sx);
      if (sy) lim = min(lim, cury / sy);
      ans += curx * cury % mo * (lim + 1) % mo;
      ans %= mo;
      ans -= curx * sy % mo * ((0 + lim) * (lim + 1) / 2 % mo) % mo;
      ans -= cury * sx % mo * ((0 + lim) * (lim + 1) / 2 % mo) % mo;
      ans += (long long)sx * sy % mo *
             (lim * (lim + 1) * (2ll * lim + 1) / 6 % mo) % mo;
      ans %= mo;
    }
  }
  ans %= mo;
  ans = (ans + mo) % mo;
  printf("%d\n", (int)ans);
  return 0;
}