#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
long long nxt[500000 + 10];
char s[500000 + 10];
long long off[500000 + 10];
int main() {
  long long n, w, h;
  scanf("%lld%lld%lld", &n, &h, &w);
  scanf("%s", s);
  long long rez = 0LL;
  long long maxx = w, maxy = h, miny = 1LL, minx = 1LL;
  long long offx = 0LL, offy = 0LL;
  for (int i = 0, _n = n; i < _n; i++) {
    if (maxx < minx || maxy < miny) break;
    if (s[i] == 'U') offy++;
    if (s[i] == 'D') offy--;
    if (s[i] == 'L') offx--;
    if (s[i] == 'R') offx++;
    if (minx + offx < 1LL)
      minx++, rez = (rez + (i + 1LL) * (maxy - miny + 1LL)) % MOD;
    if (maxx + offx > w)
      maxx--, rez = (rez + (i + 1LL) * (maxy - miny + 1LL)) % MOD;
    if (miny + offy < 1LL)
      miny++, rez = (rez + (i + 1LL) * (maxx - minx + 1LL)) % MOD;
    if (maxy + offy > h)
      maxy--, rez = (rez + (i + 1LL) * (maxx - minx + 1LL)) % MOD;
  }
  if (maxx < minx || maxy < miny) {
    printf("%lld\n", rez);
    return 0;
  }
  long long nsteps = n;
  long long first = 0LL;
  long long* prev = &first;
  for (int i = 0, _n = n; i < _n; i++) {
    nsteps++;
    if (maxx < minx || maxy < miny) break;
    if (s[i] == 'U') offy++;
    if (s[i] == 'D') offy--;
    if (s[i] == 'L') offx--;
    if (s[i] == 'R') offx++;
    if (minx + offx < 1LL) {
      minx++;
      rez = (rez + nsteps * (maxy - miny + 1LL)) % MOD;
      *prev = i;
      prev = nxt + i;
    }
    if (maxx + offx > w) {
      maxx--;
      rez = (rez + nsteps * (maxy - miny + 1LL)) % MOD;
      *prev = i;
      prev = nxt + i;
    }
    if (miny + offy < 1LL) {
      miny++;
      rez = (rez + nsteps * (maxx - minx + 1LL)) % MOD;
      *prev = i;
      prev = nxt + i;
    }
    if (maxy + offy > h) {
      maxy--;
      rez = (rez + nsteps * (maxx - minx + 1LL)) % MOD;
      *prev = i;
      prev = nxt + i;
    }
  }
  if (maxx < minx || maxy < miny) {
    printf("%lld\n", rez);
    return 0;
  }
  if (prev == &first) {
    printf("-1\n");
    return 0;
  }
  *prev = first;
  nsteps = (first + 1LL + nsteps) % MOD;
  long long i = first;
  while (maxx >= minx && maxy >= miny) {
    if (s[i] == 'U') maxy--, rez = (rez + nsteps * (maxx - minx + 1LL)) % MOD;
    if (s[i] == 'D') miny++, rez = (rez + nsteps * (maxx - minx + 1LL)) % MOD;
    if (s[i] == 'L') minx++, rez = (rez + nsteps * (maxy - miny + 1LL)) % MOD;
    if (s[i] == 'R') maxx--, rez = (rez + nsteps * (maxy - miny + 1LL)) % MOD;
    long long nasl = nxt[i];
    if (nasl <= i)
      nsteps = (nsteps + n - i + nasl) % MOD;
    else
      nsteps = (nsteps + nasl - i) % MOD;
    i = nasl;
  }
  printf("%lld\n", rez);
  return 0;
}
