#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int inf = 1e9 + 7;
int pxm[N], pxp[N], pym[N], pyp[N];
int x, y, cnx, cny, rx, ry, needx, needy, n;
int check(int w, int nex, int ney, bool fl) {
  int tempx, tempy;
  for (int i = 0; i + w - 1 < n; i++) {
    tempx = abs(nex), tempy = abs(ney);
    int chx = 0, chy = 0, xp, xm, yp, ym;
    int r = i + w - 1, l = i;
    xp = (pxp[r] - ((i == 0) ? 0 : pxp[l - 1]));
    xm = (pxm[r] - ((i == 0) ? 0 : pxm[l - 1]));
    yp = (pyp[r] - ((i == 0) ? 0 : pyp[l - 1]));
    ym = (pym[r] - ((i == 0) ? 0 : pym[l - 1]));
    if (nex > 0) {
      if (ney > 0) {
        tempx -= min(tempx / 2 * 2, xm * 2);
        if (yp + ym < tempx) {
          if (tempy == 0) continue;
          xm--;
          tempx--;
          tempy--;
          yp++;
        }
        chx = (nex - tempx) / 2;
        int needyp = 0, needym = 0;
        if (tempx != 0) {
          needym = min(tempx, ym);
          tempx -= needym;
          needyp = min(tempx, yp);
          tempx -= needyp;
        }
        tempy -= needym;
        tempy += needyp;
        chy = tempy;
        if (tempy > 0) {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (ym - needym) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xp + chx + needym + needyp &&
                tempy / 2 <= xm - chx))
            continue;
          return i + 1;
        } else {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (yp - needyp) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xp + chx + needym + needyp &&
                tempy / 2 <= xm - chx))
            continue;
          return i + 1;
        }
      } else {
        tempy *= -1;
        tempx -= min(tempx / 2 * 2, xm * 2);
        if (yp + ym < tempx) {
          if (tempy == 0) continue;
          xm--;
          tempx--;
          tempy++;
          ym++;
        }
        chx = (nex - tempx) / 2;
        int needyp = 0, needym = 0;
        if (tempx != 0) {
          needyp = min(tempx, yp);
          tempx -= needyp;
          needym = min(tempx, ym);
          tempx -= needym;
        }
        tempy += needyp;
        tempy -= needym;
        chy = tempy;
        if (tempy > 0) {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (ym - needym) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xp + chx + needym + needyp &&
                tempy / 2 <= xm - chx))
            continue;
          return i + 1;
        } else {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (yp - needyp) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xp + chx + needym + needyp &&
                tempy / 2 <= xm - chx))
            continue;
          return i + 1;
        }
      }
    } else {
      if (ney > 0) {
        tempx -= min(tempx / 2 * 2, xp * 2);
        chx = abs(abs(nex) - tempx) / 2;
        if (yp + ym < tempx) {
          if (tempy == 0) continue;
          xp--;
          tempx--;
          tempy--;
          yp++;
        }
        int needyp = 0, needym = 0;
        if (tempx != 0) {
          needym = min(tempx, ym);
          tempx -= needym;
          needyp = min(tempx, yp);
          tempx -= needyp;
        }
        tempy -= needym;
        tempy += needyp;
        chy = tempy;
        if (tempy > 0) {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (ym - needym) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xm + chx + needym + needyp &&
                tempy / 2 <= xp - chx))
            continue;
          return i + 1;
        } else {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (yp - needyp) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xm + chx + needym + needyp &&
                tempy / 2 <= xp - chx))
            continue;
          return i + 1;
        }
      } else {
        tempy *= -1;
        tempx -= min(tempx / 2 * 2, xp * 2);
        if (yp + ym < tempx) {
          if (tempy == 0) continue;
          xp--;
          tempy++;
          tempx--;
          ym++;
        }
        chx = abs(abs(nex) - tempx) / 2;
        int needyp = 0, needym = 0;
        if (tempx != 0) {
          needyp = min(tempx, yp);
          tempx -= needyp;
          needym = min(tempx, ym);
          tempx -= needym;
        }
        tempy += needyp;
        tempy -= needym;
        chy = tempy;
        if (tempy > 0) {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (ym - needym) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xm + chx + needym + needyp &&
                tempy / 2 <= xp - chx))
            continue;
          return i + 1;
        } else {
          tempy = abs(tempy);
          tempy -= min(tempy / 2 * 2, (yp - needyp) * 2);
          if (tempy & 1) continue;
          if (!(tempy / 2 <= xm + chx + needym + needyp &&
                tempy / 2 <= xp - chx))
            continue;
          return i + 1;
        }
      }
    }
  }
  return 0;
}
int main() {
  cin >> n;
  string s;
  cin >> s;
  cin >> x >> y;
  if (abs(x) + abs(y) > n) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < s.size(); i++) {
    pxm[i] += ((i == 0) ? 0 : pxm[i - 1]);
    pxp[i] += ((i == 0) ? 0 : pxp[i - 1]);
    pym[i] += ((i == 0) ? 0 : pym[i - 1]);
    pyp[i] += ((i == 0) ? 0 : pyp[i - 1]);
    pxm[i] += (s[i] == 'L');
    pxp[i] += (s[i] == 'R');
    pym[i] += (s[i] == 'D');
    pyp[i] += (s[i] == 'U');
    if (s[i] == 'U' || s[i] == 'D') {
      cny++;
      ry += ((s[i] == 'U') ? 1 : -1);
    } else {
      cnx++;
      rx += ((s[i] == 'R') ? 1 : -1);
    }
  }
  needy = (y - ry);
  needx = (x - rx);
  if (needy == 0 && needx == 0) {
    cout << 0;
    return 0;
  }
  int l = 1, r = n;
  while (r - l > 1) {
    int mid = (l + r) >> 1;
    if (check(mid, needx, needy, 1)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  if (check(l, needx, needy, 1)) r = l;
  if (!check(r, needx, needy, 1)) {
    puts("-1");
    return 0;
  }
  cout << r << endl;
}
