#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
const int P = 1e9 + 7;
int h, w, ans;
int a[2], now[2], mx[2], mn[2];
char s[N];
long long n;
vector<long long> qwq;
bool move(long long k, bool fl) {
  if (k != 0 && k % n == 0 && now[0] == 0 && now[1] == 0) {
    puts("-1");
    exit(0);
  }
  char OP = s[k % n];
  if (OP == 'U')
    fl ? now[1] = mx[1] + 1 : now[1]++;
  else if (OP == 'D')
    fl ? now[1] = mn[1] - 1 : now[1]--;
  else if (OP == 'L')
    fl ? now[0] = mx[0] + 1 : now[0]++;
  else if (OP == 'R')
    fl ? now[0] = mn[0] - 1 : now[0]--;
  bool fl1 = 0;
  for (int i = 0; i <= 1; i++) {
    if (now[i] < mn[i] || now[i] > mx[i]) {
      ans = (ans + (k + 1) % P * a[i ^ 1] % P) % P;
      a[i]--;
      fl1 = 1;
    }
    if (now[i] < mn[i]) mn[i] = now[i];
    if (now[i] > mx[i]) mx[i] = now[i];
  }
  return fl1;
}
bool checK() { return a[0] > 0 && a[1] > 0; }
int main() {
  scanf("%lld%d%d", &n, &a[1], &a[0]);
  scanf("%s", s);
  for (int i = 0; checK() && i < n; i++) move(i, 0);
  for (int i = n; checK() && i < 2 * n; i++)
    if (move(i, 0)) qwq.push_back(i % n);
  for (long long i = 2; checK(); i++)
    for (long long j = 0; j < qwq.size(); j++)
      if (checK()) move(i * n + qwq[j], 1);
  printf("%d\n", ans);
  return 0;
}
