func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   inline long long read() {     long long k = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       k = k * 10 + ch -  0 ;       ch = getchar();     }     return k * f;   }   long long n, h, w, minx = 0, maxx = 0, miny = 0, maxy = 0, ans;   long long a[500010], b[500010];   char s[500010];   inline void shuchu() {     printf( %lld , ans);     exit(0);   }   signed main() {     n = read();     h = read();     w = read();     scanf( %s , s + 1);     long long cnt = 0, x = 0, y = 0, cc = 0;     for (long long i = 1; i <= n; i++) {       cnt++;       if (s[i] ==  U ) x--;       if (s[i] ==  D ) x++;       if (s[i] ==  L ) y--;       if (s[i] ==  R ) y++;       if (x < minx) minx = x, ans = (ans + cnt * w) % MOD, h--;       if (x > maxx) maxx = x, ans = (ans + cnt * w) % MOD, h--;       if (y < miny) miny = y, ans = (ans + cnt * h) % MOD, w--;       if (y > maxy) maxy = y, ans = (ans + cnt * h) % MOD, w--;       if (h == 0 || w == 0) shuchu();     }     if (x == 0 && y == 0) return puts( -1 ) & 0;     for (long long i = 1; i <= n; i++) {       cnt++;       if (s[i] ==  U ) x--;       if (s[i] ==  D ) x++;       if (s[i] ==  L ) y--;       if (s[i] ==  R ) y++;       if (x < minx)         minx = x, ans = (ans + cnt * w) % MOD, h--, a[++cc] = 1, b[cc] = cnt % n;       if (x > maxx)         maxx = x, ans = (ans + cnt * w) % MOD, h--, a[++cc] = 2, b[cc] = cnt % n;       if (y < miny)         miny = y, ans = (ans + cnt * h) % MOD, w--, a[++cc] = 3, b[cc] = cnt % n;       if (y > maxy)         maxy = y, ans = (ans + cnt * h) % MOD, w--, a[++cc] = 4, b[cc] = cnt % n;       if (h == 0 || w == 0) shuchu();       if (cc && b[cc] == 0) b[cc] = n;     }     long long p = 2, i = 1;     while (h != 0 && w != 0) {       if (a[i] == 1 || a[i] == 2)         ans = (ans + (p * n % MOD + b[i]) * w) % MOD, h--;       if (a[i] == 3 || a[i] == 4)         ans = (ans + (p * n % MOD + b[i]) * h) % MOD, w--;       if (i == cc)         i = 1, p++;       else         i++;     }     shuchu();     return 0;   }   