#include <bits/stdc++.h>
using namespace std;
const int NMAX = 500010;
const long long MOD = 1000000007;
int n, h, w;
char moves[NMAX];
int offset_x, offset_y;
int max_offset_x, max_offset_y, min_offset_x, min_offset_y;
vector<pair<int, char> > changes;
int t;
long long ans;
int main() {
  scanf("%d%d%d%s", &n, &h, &w, moves + 1);
  for (int i = 1; i <= n; i++) {
    if (w == 0 || h == 0) break;
    if (moves[i] == 'U')
      offset_x -= 1;
    else if (moves[i] == 'D')
      offset_x += 1;
    else if (moves[i] == 'L')
      offset_y -= 1;
    else if (moves[i] == 'R')
      offset_y += 1;
    if (offset_x > max_offset_x || offset_x < min_offset_x)
      ans += ((long long)i * (long long)w) % MOD, h -= 1;
    if (offset_y > max_offset_y || offset_y < min_offset_y)
      ans += ((long long)i * (long long)h) % MOD, w -= 1;
    max_offset_x = max(max_offset_x, offset_x);
    min_offset_x = min(min_offset_x, offset_x);
    max_offset_y = max(max_offset_y, offset_y);
    min_offset_y = min(min_offset_y, offset_y);
    ans %= MOD;
  }
  for (int i = 1; i <= n; i++) {
    if (w == 0 || h == 0) break;
    if (moves[i] == 'U')
      offset_x -= 1;
    else if (moves[i] == 'D')
      offset_x += 1;
    else if (moves[i] == 'L')
      offset_y -= 1;
    else if (moves[i] == 'R')
      offset_y += 1;
    if (offset_x > max_offset_x || offset_x < min_offset_x)
      changes.push_back(make_pair(i, 'h'));
    if (offset_y > max_offset_y || offset_y < min_offset_y)
      changes.push_back(make_pair(i, 'w'));
    max_offset_x = max(max_offset_x, offset_x);
    min_offset_x = min(min_offset_x, offset_x);
    max_offset_y = max(max_offset_y, offset_y);
    min_offset_y = min(min_offset_y, offset_y);
  }
  if (changes.size() == 0 && (w != 0 && h != 0)) {
    printf("-1\n");
    return 0;
  }
  while (w != 0 && h != 0) {
    t += 1;
    for (int i = 0; i < (int)changes.size(); i++) {
      if (w == 0 || h == 0) break;
      if (changes[i].second == 'h') {
        ans += (((long long)changes[i].first +
                 ((long long)t * (long long)n) % MOD) *
                (long long)w) %
               MOD;
        h -= 1;
      } else if (changes[i].second == 'w') {
        ans += (((long long)changes[i].first +
                 ((long long)t * (long long)n) % MOD) *
                (long long)h) %
               MOD;
        w -= 1;
      }
      ans %= MOD;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
