#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 10, mod = 1e9 + 7;
char s[N];
long long op[N], t[N];
void move(long long &x, long long &y, long long id) {
  if (s[id] == 'U') x--;
  if (s[id] == 'D') x++;
  if (s[id] == 'L') y--;
  if (s[id] == 'R') y++;
}
signed main() {
  long long n, h, w, ans = 0, cnt = 0;
  scanf("%lld%lld%lld%s", &n, &h, &w, s + 1);
  long long x1 = 1, y1 = 1, x2 = h, y2 = w;
  for (long long i = 1; i <= n; i++) {
    move(x1, y1, i), move(x2, y2, i);
    if (x1 > x2 || y1 > y2) break;
    if (!x1) ans = (ans + i * (y2 - y1 + 1) % mod) % mod, x1 = 1;
    if (x2 > h) ans = (ans + i * (y2 - y1 + 1) % mod) % mod, x2 = h;
    if (!y1) ans = (ans + i * (x2 - x1 + 1) % mod) % mod, y1 = 1;
    if (y2 > w) ans = (ans + i * (x2 - x1 + 1) % mod) % mod, y2 = w;
  }
  for (long long i = 1; i <= n; i++) {
    move(x1, y1, i), move(x2, y2, i);
    if (x1 > x2 || y1 > y2) break;
    if (!x1) {
      ans = (ans + (n + i) * (y2 - y1 + 1)) % mod, x1 = 1;
      op[++cnt] = 0, t[cnt] = i;
    }
    if (x2 > h) {
      ans = (ans + (n + i) * (y2 - y1 + 1)) % mod, x2 = h;
      op[++cnt] = 0, t[cnt] = i;
    }
    if (!y1) {
      ans = (ans + (n + i) * (x2 - x1 + 1)) % mod, y1 = 1;
      op[++cnt] = 1, t[cnt] = i;
    }
    if (y2 > w) {
      ans = (ans + (n + i) * (x2 - x1 + 1)) % mod, y2 = w;
      op[++cnt] = 1, t[cnt] = i;
    }
  }
  if (!cnt && x1 <= x2 && y1 <= y2) {
    printf("-1");
    return 0;
  }
  long long x = x2 - x1 + 1, y = y2 - y1 + 1;
  for (long long i = 2; x > 0, y > 0; i++) {
    if (!x || !y) break;
    for (long long j = 1; j <= cnt; j++) {
      if (!op[j] && x > 0 && y > 0)
        ans = (ans + (n * i + t[j]) % mod * y) % mod, x--;
      if (op[j] && x > 0 && y > 0)
        ans = (ans + (n * i + t[j]) % mod * x) % mod, y--;
    }
  }
  printf("%lld", ans);
  return 0;
}
