#include <bits/stdc++.h>
using namespace std;
int n, i, a, b, aux1, aux2, cs, cd, mij, rsp;
char s[200005];
int u[200005], r[200005], l[200005], d[200005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  cin >> s;
  cin >> a >> b;
  if (abs(a) + abs(b) > n) {
    cout << -1;
    return 0;
  }
  if ((abs(a) + abs(b)) % 2 != n % 2) {
    cout << -1;
    return 0;
  }
  for (i = 0; i < n; i++) {
    if (s[i] == 'U') u[i + 1]++;
    if (s[i] == 'D') d[i + 1]++;
    if (s[i] == 'L') l[i + 1]++;
    if (s[i] == 'R') r[i + 1]++;
  }
  for (i = 1; i <= n; i++) {
    u[i] += u[i - 1];
    r[i] += r[i - 1];
    d[i] += d[i - 1];
    l[i] += l[i - 1];
  }
  if (u[n] - d[n] == b && r[n] - l[n] == a) {
    cout << 0;
    return 0;
  }
  rsp = n;
  for (i = 1; i <= n; i++) {
    cs = i;
    cd = n;
    while (cs <= cd) {
      mij = (cs + cd) >> 1;
      aux1 = r[i - 1];
      aux1 -= l[i - 1];
      aux1 += r[n] - r[mij];
      aux1 -= l[n] - l[mij];
      aux2 = u[i - 1];
      aux2 -= d[i - 1];
      aux2 += u[n] - u[mij];
      aux2 -= d[n] - d[mij];
      if (abs(aux1 - a) + abs(aux2 - b) <= mij - i + 1) {
        rsp = min(rsp, mij - i + 1);
        cd = mij - 1;
      } else
        cs = mij + 1;
    }
  }
  cout << rsp;
}
