#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
bool ans(int x, int y, int n) {
  if (abs(x) + abs(y) > n || (n - abs(x) + abs(y)) % 2) return false;
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  string str;
  cin >> str;
  int x, y;
  cin >> x >> y;
  vector<pair<int, int> > pre(n + 2), suf(n + 2);
  pre[0] = suf[n + 1] = {0, 0};
  int cx = 0, cy = 0;
  for (int i = 0; i < n; ++i) {
    if (str[i] == 'R') cx++;
    if (str[i] == 'L') cx--;
    if (str[i] == 'U') cy++;
    if (str[i] == 'D') cy--;
    pre[i + 1] = {cx, cy};
  }
  cx = cy = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (str[i] == 'R') cx++;
    if (str[i] == 'L') cx--;
    if (str[i] == 'U') cy++;
    if (str[i] == 'D') cy--;
    suf[i + 1] = {cx, cy};
  }
  if (x == cx && y == cy) {
    cout << 0;
    return 0;
  }
  if (!ans(x, y, n)) {
    cout << -1;
    return 0;
  }
  int beg = 1, end = n;
  while (beg < end) {
    int mid = beg + (end - beg) / 2;
    int size = mid;
    bool pos = 0;
    for (int i = 1, j = size; j <= n; ++i, ++j) {
      int cx = pre[i - 1].first + suf[j + 1].first;
      int cy = pre[i - 1].second + suf[j + 1].second;
      if (ans(x - cx, y - cy, size)) {
        pos = 1;
        break;
      }
    }
    if (pos)
      end = mid;
    else
      beg = mid + 1;
  }
  cout << beg << "\n";
}
