#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     long long r;     while (b != 0) {       r = a % b;       a = b;       b = r;     }     return a;   }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   long long fpow(long long n, long long k, int p = (int)1e9 + 7) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   const int MOD = (int)1e9 + 7;   const int INF = (int)1e9;   const long long LINF = (long long)1e18;   const long double PI = 2 * acos((long double)0);   const int maxn = 500010;   int n, w, h;   char s[maxn];   int xmin[maxn];   int xmax[maxn];   int ymin[maxn];   int ymax[maxn];   long long alox[maxn];   long long aloy[maxn];   long long tot[maxn];   void solve() {     scanf( %d%d%d%s , &n, &h, &w, s);     int dx = 0, dy = 0;     for (int i = (0); i < (n); i++) {       if (s[i] ==  L )         dx--;       else if (s[i] ==  R )         dx++;       else if (s[i] ==  U )         dy--;       else         dy++;       if (!i) {         xmin[i] = xmax[i] = dx;         ymin[i] = ymax[i] = dy;       } else {         xmin[i] = min(xmin[i - 1], dx);         xmax[i] = max(xmax[i - 1], dx);         ymin[i] = min(ymin[i - 1], dy);         ymax[i] = max(ymax[i - 1], dy);       }     }     for (int i = (0); i < (w); i++) {       int c = 0;       if (i + xmin[n - 1] >= 0 && i + xmax[n - 1] < w) {         int l = 0, r = INF;         while (l < r) {           int m = (l + r) >> 1;           if (dx >= 0) {             if (i + xmax[n - 1] + 1LL * m * dx < w)               l = m + 1;             else               r = m;           } else {             if (i + xmin[n - 1] + 1LL * m * dx >= 0)               l = m + 1;             else               r = m;           }         }         c = l;       }       if (c == INF) {         alox[i] = -1;         continue;       }       int l = 0, r = n - 1;       while (l < r) {         int m = (l + r) >> 1;         if (i + xmin[m] + 1LL * c * dx >= 0 && i + xmax[m] + 1LL * c * dx < w)           l = m + 1;         else           r = m;       }       alox[i] = 1LL * c * n + l + 1;     }     for (int i = (0); i < (h); i++) {       int c = 0;       if (i + ymin[n - 1] >= 0 && i + ymax[n - 1] < h) {         int l = 0, r = INF;         while (l < r) {           int m = (l + r) >> 1;           if (dy >= 0) {             if (i + ymax[n - 1] + 1LL * m * dy < h)               l = m + 1;             else               r = m;           } else {             if (i + ymin[n - 1] + 1LL * m * dy >= 0)               l = m + 1;             else               r = m;           }         }         c = l;       }       if (c == INF) {         aloy[i] = -1;         continue;       }       int l = 0, r = n - 1;       while (l < r) {         int m = (l + r) >> 1;         if (i + ymin[m] + 1LL * c * dy >= 0 && i + ymax[m] + 1LL * c * dy < h)           l = m + 1;         else           r = m;       }       aloy[i] = 1LL * c * n + l + 1;     }     int flagx = 0, flagy = 0;     for (int i = (0); i < (w); i++) {       if (!~alox[i]) {         flagx = 1;         alox[i] = LINF;       }     }     for (int i = (0); i < (h); i++) {       if (!~aloy[i]) {         flagy = 1;         aloy[i] = LINF;       }     }     if (flagx && flagy) {       printf( -1 );       return;     }     int ans = 0;     sort(aloy, aloy + h);     for (int i = (0); i < (h); i++) {       if (!i)         tot[i] = aloy[i] % MOD;       else         tot[i] = (tot[i - 1] + aloy[i]) % MOD;     }     for (int i = (0); i < (w); i++) {       int k = upper_bound(aloy, aloy + h, alox[i]) - aloy - 1;       if (~k) ans = (ans + tot[k]) % MOD;       ans = (ans + 1LL * (h - k - 1) * alox[i]) % MOD;     }     printf( %d , ans);   }   int main() {     solve();     return 0;   }