#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
long long min(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << ", ";
  err(++it, args...);
}
template <typename T>
struct number_iterator : std::iterator<random_access_iterator_tag, T> {
  T v;
  number_iterator(T _v) : v(_v) {}
  operator T&() { return v; }
  T operator*() const { return v; }
};
template <typename T>
struct number_range {
  T b, e;
  number_range(T b, T e) : b(b), e(e) {}
  number_iterator<T> begin() { return b; }
  number_iterator<T> end() { return e; }
};
template <typename T>
number_range<T> range(T e) {
  return number_range<T>(1, e + 1);
}
template <typename T>
number_range<T> range(T b, T e) {
  return number_range<T>(b, e + 1);
}
int n, w, h;
string x;
int dx[5] = {0, -1, 0, 1}, dy[5] = {-1, 0, 1, 0};
int a[600001];
char z[5] = {'L', 'U', 'R', 'D'};
long long res = 0;
int u, b, l, r;
struct E {
  int t;
  int dir;
  E() {}
  E(int t, int dir) : t(t), dir(dir) {}
};
long long bigmod(long long a, long long p) {
  if (p == 1) return a;
  if (!p) return 1;
  long long t = bigmod(a, p >> 1);
  t = t * t % 1000000007;
  if (p & 1) t = t * a % 1000000007;
  return t;
}
bool operator<(E u, E v) { return u.t > v.t; }
priority_queue<E> Q;
vector<E> T;
vector<E> TY[5];
int main() {
  scanf("%d%d%d", &n, &h, &w);
  cin >> x;
  for (int i = (1); i <= (n); i++) {
    for (int j = (0); j <= (3); j++)
      if (z[j] == x[i - 1]) a[i] = j;
  }
  u = b = l = r = 0;
  int cx = 0, cy = 0;
  long long survive = (long long)h * w;
  long long hh = h;
  long long ww = w;
  for (int i = (1); i <= (n); i++) {
    res = (res + survive) % 1000000007;
    cx += dx[a[i]];
    cy += dy[a[i]];
    if (u > cx || b < cx || l > cy || r < cy) {
      Q.push(E(i, a[i]));
      TY[a[i]].push_back(E(i, a[i]));
      if (u > cx || b < cx) {
        survive -= ww;
        hh--;
      } else {
        survive -= hh;
        ww--;
      }
    }
    if (ww == 0 || hh == 0) {
      cout << res << endl;
      return 0;
    }
    u = min(u, cx);
    b = max(b, cx);
    l = min(l, cy);
    r = max(r, cy);
  }
  while (Q.size()) {
    T.push_back(Q.top());
    Q.pop();
  }
  if (cx == 0 && cy == 0 && (r - l + 1) <= w && (b - u + 1) <= h) {
    puts("-1");
    return 0;
  } else {
    if (cx < 0) {
      int cnt = (cx - u);
      for (int i = (0); i < (TY[1].size()); i++)
        if (i >= cnt) Q.push(TY[1][i]);
    }
    if (cx > 0) {
      int cnt = (b - cx);
      for (int i = (0); i < (TY[3].size()); i++)
        if (i >= cnt) Q.push(TY[3][i]);
    }
    if (cy > 0) {
      int cnt = (r - cy);
      for (int i = (0); i < (TY[2].size()); i++)
        if (i >= cnt) Q.push(TY[2][i]);
    }
    if (cy < 0) {
      int cnt = (cy - l);
      for (int i = (0); i < (TY[0].size()); i++)
        if (i >= cnt) Q.push(TY[0][i]);
    }
    survive %= 1000000007;
    long long curt = 0;
    while (T.size()) T.pop_back();
    while (Q.size()) {
      T.push_back(Q.top());
      Q.pop();
    }
    int dh = 0, dw = 0;
    for (auto Z : T) {
      if (Z.dir == 0 || Z.dir == 2)
        dw++;
      else
        dh++;
    }
    long long k;
    if (!dw)
      k = hh / dh;
    else if (!dh)
      k = ww / dw;
    else
      k = min(hh / dh, ww / dw);
    int dh2 = 0, dw2 = 0;
    for (auto Z : T) {
      if (Z.dir == 0 || Z.dir == 2) {
        long long h2 = hh - dh2;
        long long s1 = (Z.t) % 1000000007;
        long long s2 = (k * h2) % 1000000007;
        long long k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * dh % 1000000007;
        s2 = (s2 + 1000000007 - k1) % 1000000007;
        s2 = s2 * s1 % 1000000007;
        k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * h2 % 1000000007;
        long long k2 = k - 1;
        k2 = k2 * (k2 + 1) % 1000000007 * (2 * k2 + 1) % 1000000007 *
             bigmod(6, 1000000007 - 2) % 1000000007;
        k2 = k2 * dh % 1000000007;
        k1 = (k1 + 1000000007 - k2) % 1000000007 * n % 1000000007;
        res = (res + s2 + k1) % 1000000007;
        dw2++;
      } else {
        long long w2 = ww - dw2;
        long long s1 = (Z.t) % 1000000007;
        long long s2 = (k * w2) % 1000000007;
        long long k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * dw % 1000000007;
        s2 = (s2 + 1000000007 - k1) % 1000000007;
        s2 = s2 * s1 % 1000000007;
        k1 = k - 1;
        k1 = k1 * (k1 + 1) / 2;
        k1 = k1 % 1000000007 * w2 % 1000000007;
        long long k2 = k - 1;
        k2 = k2 * (k2 + 1) % 1000000007 * (2 * k2 + 1) % 1000000007 *
             bigmod(6, 1000000007 - 2) % 1000000007;
        k2 = k2 * dw % 1000000007;
        k1 = (k1 + 1000000007 - k2) % 1000000007 * n % 1000000007;
        res = (res + s2 + k1) % 1000000007;
        dh2++;
      }
    }
    int now = 0;
    ww -= k * dw;
    hh -= k * dh;
    survive = ww * hh % 1000000007;
    long long ct = k * n % 1000000007;
    res = (res + (survive * ct) % 1000000007) % 1000000007;
    while (ww && hh) {
      res = (res + (survive * (T[now].t - curt)) % 1000000007) % 1000000007;
      curt = T[now].t;
      if (T[now].dir == 0 || T[now].dir == 2) {
        survive = (survive + 1000000007 - hh) % 1000000007;
        ww--;
      } else {
        survive = (survive + 1000000007 - ww) % 1000000007;
        hh--;
      }
      now++;
      if (now == T.size()) {
        now -= T.size();
        curt -= n;
      }
    }
    cout << res << endl;
  }
  return 0;
}
