#include <bits/stdc++.h>
using namespace std;
const int N = (int)5e5 + 5;
const long long oo = (long long)1e18 + 7;
const long long base = (long long)1e9 + 7;
int n, h, w;
long long negx[N], posx[N], negy[N], posy[N], minx[N], miny[N], cnt;
char s[N];
void init(char neg, char pos, long long neg_arr[], long long pos_arr[],
          long long min_arr[], int side) {
  int cur = 0;
  for (int i = 1; i <= n; ++i) {
    cur += ((s[i] == pos) - (s[i] == neg));
    if (cur < 0 && !neg_arr[-cur]) neg_arr[-cur] = i;
    if (cur > 0 && !pos_arr[cur]) pos_arr[cur] = i;
  }
  for (int i = 1; i <= side; ++i) {
    if (!pos_arr[i]) {
      if (cur > 0)
        pos_arr[i] = (long long)n + pos_arr[i - cur];
      else
        pos_arr[i] = oo;
    }
    if (!neg_arr[i]) {
      if (cur < 0)
        neg_arr[i] = (long long)n + neg_arr[i + cur];
      else
        neg_arr[i] = oo;
    }
  }
  bool ok = true;
  for (int i = 1; i <= side; ++i) {
    min_arr[i] = min(neg_arr[i], pos_arr[side - i + 1]);
    if (min_arr[i] == oo) cnt += ok, ok = false;
  }
}
long long solve(long long a[], long long b[], int na, int nb, long long add) {
  long long ret = 0;
  for (int i = 1; i <= na; ++i) {
    if (a[i] == oo) continue;
    int pos = lower_bound(b + 1, b + nb + 1, a[i] + add) - b;
    ret = (ret + ((a[i] % base) * (long long)(nb - pos + 1)) % base) % base;
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &h, &w);
  scanf("%s", s + 1);
  init('U', 'D', negx, posx, minx, h);
  init('L', 'R', negy, posy, miny, w);
  if (cnt == 2) {
    puts("-1");
    return 0;
  }
  sort(minx + 1, minx + h + 1);
  sort(miny + 1, miny + w + 1);
  long long res =
      (solve(minx, miny, h, w, 1) + solve(miny, minx, w, h, 0)) % base;
  printf("%I64d", res);
  return 0;
}
