#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 1e2;
void stndrtn() {}
const bool flag = 0;
void ma1n() {
  int n, h, w;
  cin >> n >> h >> w;
  string s;
  cin >> s;
  ll ans = 0;
  auto Move = [&](int& first, int& second, char c) {
    first -= c == 'L';
    first += c == 'R';
    second += c == 'U';
    second -= c == 'D';
  };
  int first = 0, second = 0;
  vector<int> v;
  unordered_set<int> sx, sy;
  sx.insert(0), sy.insert(0);
  for (int i = 1; i <= n; ++i) {
    char c = s[i - 1];
    Move(first, second, c);
    if (!sx.count(first)) {
      sx.insert(first);
      w--, ans = (ans + h * 1ll * i) % MOD;
    }
    if (!sy.count(second)) {
      sy.insert(second);
      h--, ans = (ans + w * 1ll * i) % MOD;
    }
    if (!h || !w) {
      cout << ans, exit(0);
    }
  }
  for (int i = 1; i <= n; ++i) {
    char c = s[i - 1];
    Move(first, second, c);
    if (!sx.count(first)) {
      sx.insert(first);
      v.push_back(i);
    }
    if (!sy.count(second)) {
      sy.insert(second);
      v.push_back(-i);
    }
  }
  if (!first && !second) {
    cout << "-1\n", exit(0);
  }
  int pos = 0, lps = 1;
  while (h && w) {
    if (v[pos] > 0) {
      w--, ans = ll(ans + (v[pos] + n * 1ll * lps) * 1ll * h) % MOD;
    } else {
      h--, ans = ll(ans + (-v[pos] + n * 1ll * lps) * 1ll * w) % MOD;
    }
    pos++;
    if (pos == (int)v.size()) {
      pos = 0, lps++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr), stndrtn();
  int ts = 1;
  if (flag) {
    cin >> ts;
  }
  while (ts--) {
    ma1n();
  }
  return 0;
}
