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 long long mod = 1e9 + 7;
long long sumh1[500010], h, sumh2[500010], pstvx[500010], pstvy[500010],
    ngtvx[500010], ngtvy[500010], pdisx[500010], pdisy[500010], ndisx[500010],
    ndisy[500010], tim;
bool chck1(long long m) { return pdisy[m] <= tim; }
bool chck2(long long m) { return ndisy[h - 1 - m] <= tim; }
char c[500010];
int main() {
  long long x, y, n, w, mxx, mnx, mxy, mny;
  cin >> n >> h >> w;
  scanf("%s", c);
  x = 0;
  y = 0;
  mxx = mnx = mxy = mny = 0;
  fill(pstvx, pstvx + w + 1, 1e18);
  fill(pstvy, pstvy + h + 1, 1e18);
  fill(ngtvx, ngtvx + w + 1, 1e18);
  fill(ngtvy, ngtvy + h + 1, 1e18);
  fill(pdisx, pdisx + w + 1, 1e18);
  fill(pdisy, pdisy + h + 1, 1e18);
  fill(ndisx, ndisx + w + 1, 1e18);
  fill(ndisy, ndisy + h + 1, 1e18);
  pstvx[0] = 0;
  pstvy[0] = 0;
  ngtvx[0] = 0;
  ngtvy[0] = 0;
  for (long long i = 0; i < n; ++i) {
    if (c[i] == 'R') {
      ++x;
    } else if (c[i] == 'L') {
      --x;
    } else if (c[i] == 'U') {
      ++y;
    } else {
      --y;
    }
    if (x > 0)
      pstvx[x] = min(pstvx[x], i + 1);
    else
      ngtvx[-x] = min(ngtvx[-x], i + 1);
    if (y > 0)
      pstvy[y] = min(pstvy[y], i + 1);
    else
      ngtvy[-y] = min(ngtvy[-y], i + 1);
    mxx = max(mxx, x);
    mxy = max(mxy, y);
    mnx = max(mnx, -x);
    mny = max(mny, -y);
  }
  if (x == 0 && y == 0 && mxx + mnx < w && mxy + mny < h) {
    cout << -1 << endl;
    return 0;
  }
  long long shftx = x;
  long long shfty = y;
  long long cnt = 0, tmp = 0;
  if (shftx > 0) {
    for (long long i = 0; i < w; ++i) {
      if ((i + 1) - cnt > mxx) {
        cnt += shftx;
        tmp += n;
      }
      pdisx[i] = tmp + pstvx[(i + 1) - cnt];
    }
    for (long long i = 0; i < mnx; ++i) {
      ndisx[i] = ngtvx[i + 1];
    }
  } else if (shftx < 0) {
    shftx *= -1ll;
    for (long long i = 0; i < w; ++i) {
      if ((i + 1) - cnt > mnx) {
        cnt += shftx;
        tmp += n;
      }
      ndisx[i] = tmp + ngtvx[(i + 1) - cnt];
    }
    for (long long i = 0; i < mxx; ++i) {
      pdisx[i] = pstvx[i + 1];
    }
  } else {
    for (long long i = 0; i < mnx; ++i) {
      ndisx[i] = ngtvx[i + 1];
    }
    for (long long i = 0; i < mxx; ++i) {
      pdisx[i] = pstvx[i + 1];
    }
  }
  cnt = 0;
  tmp = 0;
  if (shfty > 0) {
    for (long long i = 0; i < h; ++i) {
      if ((i + 1) - cnt > mxy) {
        cnt += shfty;
        tmp += n;
      }
      pdisy[i] = tmp + pstvy[(i + 1) - cnt];
    }
    for (long long i = 0; i < mny; ++i) {
      ndisy[i] = ngtvy[i + 1];
    }
  } else if (shfty < 0) {
    shfty *= -1ll;
    for (long long i = 0; i < h; ++i) {
      if ((i + 1) - cnt > mny) {
        cnt += shfty;
        tmp += n;
      }
      ndisy[i] = tmp + ngtvy[(i + 1) - cnt];
    }
    for (long long i = 0; i < mxy; ++i) {
      pdisy[i] = pstvy[i + 1];
    }
  } else {
    for (long long i = 0; i < mny; ++i) {
      ndisy[i] = ngtvy[i + 1];
    }
    for (long long i = 0; i < mxy; ++i) {
      pdisy[i] = pstvy[i + 1];
    }
  }
  sumh1[0] = pdisy[0];
  for (long long i = 1; i < h; ++i) {
    sumh1[i] = sumh1[i - 1] + pdisy[i];
  }
  sumh2[0] = ndisy[0];
  for (long long i = 1; i < h; ++i) {
    sumh2[i] = sumh2[i - 1] + ndisy[i];
  }
  long long end = -1;
  for (long long i = 0; i < h; ++i) {
    if (pdisy[i] > ndisy[h - i - 1]) break;
    end = i;
  }
  long long res = 0;
  for (long long i = 0; i < w; ++i) {
    tim = min(pdisx[w - i - 1], ndisx[i]);
    long long st = -1, nd = h - 1, mid;
    while (st < nd) {
      mid = (st + nd + 1) / 2ll;
      if (chck1(mid)) {
        st = mid;
      } else {
        nd = mid - 1;
      }
    }
    long long tmp2 = min(end, st);
    res += (end - tmp2) * tim;
    if (tmp2 >= 0) res += sumh1[tmp2];
    st = h, nd = 0;
    while (st > nd) {
      mid = (st + nd) / 2ll;
      if (chck2(mid)) {
        st = mid;
      } else {
        nd = mid + 1;
      }
    }
    tmp2 = max(st, end + 1);
    res += (tmp2 - end - 1) * tim;
    if (tmp2 < h) res += sumh2[h - tmp2 - 1];
    res %= mod;
  }
  cout << res << endl;
  return 0;
}