#include <bits/stdc++.h>
using namespace std;
string s;
int r = 0, c = 0;
int n, x, y;
bool check(int m) {
  int cr = 0, cc = 0;
  for (int i = 0; i < m; i++) {
    if (s[i] == 'R')
      cr++;
    else if (s[i] == 'L')
      cr--;
    else if (s[i] == 'U')
      cc++;
    else
      cc--;
  }
  int ncr = r - cr;
  int ncc = c - cc;
  if (abs(x - ncr) + abs(ncc - y) <= m &&
      (abs(x - ncr) + abs(ncc - y)) % 2 == m % 2)
    return 1;
  for (int i = m; i < n; i++) {
    if (s[i - m] == 'R')
      cr--;
    else if (s[i - m] == 'L')
      cr++;
    else if (s[i - m] == 'U')
      cc--;
    else
      cc++;
    if (s[i] == 'R')
      cr++;
    else if (s[i] == 'L')
      cr--;
    else if (s[i] == 'U')
      cc++;
    else
      cc--;
    ncr = r - cr;
    ncc = c - cc;
    if (abs(x - ncr) + abs(ncc - y) <= m &&
        (abs(x - ncr) + abs(ncc - y)) % 2 == m % 2)
      return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R')
      r++;
    else if (s[i] == 'L')
      r--;
    else if (s[i] == 'U')
      c++;
    else
      c--;
  }
  cin >> x >> y;
  if (x == r && c == y)
    cout << 0 << endl;
  else {
    int s = 1, e = n, ans = -1;
    while (s <= e) {
      int mid = (s + e) >> 1;
      if (check(mid))
        e = mid - 1, ans = mid;
      else
        s = mid + 1;
    }
    cout << ans << endl;
  }
  return 0;
}
