func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long orz = 1e9 + 7;   char s[500100];   vector<long long> xc;   vector<long long> yc;   vector<long long> tempx;   vector<long long> tempy;   int n, h, w, len, x, y, ly, uy, lx, rx, i, nx, ny, xs, ys, flag;   long long ans, temp;   int main() {     scanf( %d%d%d , &n, &h, &w);     scanf( %s , s);     len = strlen(s);     x = y = ly = uy = lx = rx = 0;     for (i = 0; i < len; i++) {       if (s[i] ==  L ) {         x -= 1;         if (x < lx) lx = x, xc.push_back(i);       } else if (s[i] ==  U ) {         y -= 1;         if (y < uy) uy = y, yc.push_back(i);       } else if (s[i] ==  D ) {         y += 1;         if (y > ly) ly = y, yc.push_back(i);       } else if (s[i] ==  R ) {         x += 1;         if (x > rx) rx = x, xc.push_back(i);       }     }     for (i = 0; i < len; i++) {       if (s[i] ==  L ) {         x -= 1;         if (x < lx) lx = x, tempx.push_back(i);       } else if (s[i] ==  U ) {         y -= 1;         if (y < uy) uy = y, tempy.push_back(i);       } else if (s[i] ==  D ) {         y += 1;         if (y > ly) ly = y, tempy.push_back(i);       } else if (s[i] ==  R ) {         x += 1;         if (x > rx) rx = x, tempx.push_back(i);       }     }     if (tempx.size() != 0)       while (xc.size() < w)         for (i = 0; i < tempx.size(); i++) {           tempx[i] += n;           xc.push_back(tempx[i]);         }     for (i = 0; i < xc.size(); i++) xc[i] += 1;     if (tempy.size() != 0)       while (yc.size() < h)         for (i = 0; i < tempy.size(); i++) {           tempy[i] += n;           yc.push_back(tempy[i]);         }     for (i = 0; i < yc.size(); i++) yc[i] += 1;     xs = xc.size(), ys = yc.size(), nx = ny = 0;     while (nx < xs || ny < ys) {       if (h == 0 || w == 0) break;       flag = (ys == ny || xs > nx && xc[nx] < yc[ny]);       if (flag) {         temp = (h % orz) * (xc[nx] % orz);         ans += temp;         ans %= orz;         nx += 1, w -= 1;       } else {         temp = (w % orz) * (yc[ny] % orz);         ans += temp;         ans %= orz;         ny += 1, h -= 1;       }     }     if (h > 0 && w > 0)       puts( -1 );     else       printf( %I64d n , ans);   }   