#include <bits/stdc++.h>
using namespace std;
char *s;
char *sf, *bsf;
int *idx, *bidx;
int size, bsize;
void put(int i) {
  sf[size] = s[i];
  idx[size] = i + 1;
  size++;
}
void bput(int i) {
  bsf[bsize] = sf[i];
  bidx[bsize] = idx[i];
  bsize++;
}
int main() {
  int n, h, w;
  scanf("%d %d %d", &n, &h, &w);
  s = (char *)malloc((n + 1) * sizeof(char));
  scanf("%s", s);
  sf = (char *)malloc(n * sizeof(char));
  idx = (int *)malloc(n * sizeof(int));
  size = 0;
  int down = 0, right = 0;
  int us = 0, ds = 0, ls = 0, rs = 0;
  for (int i = 0; i < n; i++) {
    switch (s[i]) {
      case 'U':
        if (-(--down) > us) {
          us++;
          put(i);
        }
        break;
      case 'D':
        if (++down > ds) {
          ds++;
          put(i);
        }
        break;
      case 'L':
        if (-(--right) > ls) {
          ls++;
          put(i);
        }
        break;
      case 'R':
        if (++right > rs) {
          rs++;
          put(i);
        }
        break;
    }
  }
  int ans = 0;
  for (int i = 0; i < size && h > 0 && w > 0; i++) {
    switch (sf[i]) {
      case 'U':
      case 'D':
        h--;
        ans = (ans + 1ll * w * idx[i]) % 1000000007;
        break;
      case 'L':
      case 'R':
        w--;
        ans = (ans + 1ll * h * idx[i]) % 1000000007;
        break;
    }
  }
  if (right == 0 && down == 0 && h > 0 && w > 0) {
    printf("-1\n");
    return 0;
  }
  int ux, dx, lx, rx;
  ux = max(0, -down);
  dx = max(0, down);
  lx = max(0, -right);
  rx = max(0, right);
  bsf = (char *)malloc(n * sizeof(char));
  bidx = (int *)malloc(n * sizeof(int));
  bsize = 0;
  for (int i = size - 1; ux > 0 || dx > 0 || lx > 0 || rx > 0; i--) {
    switch (sf[i]) {
      case 'U':
        if (ux > 0) {
          bput(i);
          ux--;
        }
        break;
      case 'D':
        if (dx > 0) {
          bput(i);
          dx--;
        }
        break;
      case 'L':
        if (lx > 0) {
          bput(i);
          lx--;
        }
        break;
      case 'R':
        if (rx > 0) {
          bput(i);
          rx--;
        }
        break;
    }
  }
  for (int i = 0; h > 0 && w > 0; i++) {
    if (i % bsize == 0) ans = (ans + 1ll * h * w * n) % 1000000007;
    switch (bsf[bsize - 1 - (i % bsize)]) {
      case 'U':
      case 'D':
        h--;
        ans = (ans + 1ll * w * bidx[bsize - 1 - (i % bsize)]) % 1000000007;
        break;
      case 'L':
      case 'R':
        w--;
        ans = (ans + 1ll * h * bidx[bsize - 1 - (i % bsize)]) % 1000000007;
        break;
    }
  }
  printf("%d\n", ans);
  return 0;
}
