#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  string s;
  int finish_x, finish_y;
  cin >> n >> s >> finish_x >> finish_y;
  if (n < abs(finish_x) + abs(finish_y) ||
      n % 2 != (abs(finish_x) + abs(finish_y)) % 2) {
    cout << -1;
    return 0;
  }
  vector<int> dx(n + 1), dy(n + 1);
  dx[n] = dy[n] = 0;
  map<char, pair<int, int>> m;
  m['U'] = {0, 1};
  m['D'] = {0, -1};
  m['L'] = {-1, 0};
  m['R'] = {1, 0};
  for (int i = n - 1; i >= 0; --i) {
    auto &[cdx, cdy] = m[s[i]];
    dx[i] = dx[i + 1] + cdx;
    dy[i] = dy[i + 1] + cdy;
  }
  vector<int> x(n + 1), y(n + 1);
  x[0] = y[0] = 0;
  for (int i = 0; i < n; ++i) {
    auto [cdx, cdy] = m[s[i]];
    x[i + 1] = x[i] + cdx;
    y[i + 1] = y[i] + cdy;
  }
  int l = -1, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    bool good = false;
    for (int i = 0; i <= n - m; ++i) {
      int u = x[i] + dx[i + m];
      int v = y[i] + dy[i + m];
      if (abs(finish_x - u) + abs(finish_y - v) <= m) {
        good = true;
        break;
      }
    }
    if (good)
      r = m;
    else
      l = m;
  }
  cout << r;
}
