#include <bits/stdc++.h>
using namespace std;
long long idx(char c) {
  if (c == 'L')
    return 0;
  else if (c == 'R')
    return 1;
  else if (c == 'D')
    return 2;
  else
    return 3;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long x, y;
  cin >> x >> y;
  if (abs(x) + abs(y) > n or (n - abs(x) - abs(y)) % 2) {
    cout << -1 << '\n';
    return 0;
  }
  vector<vector<long long> > pf(n, vector<long long>(4, 0));
  for (long long i = 0; i < n; i++) {
    pf[i][idx(s[i])]++;
    if (i > 0) {
      for (long long j = 0; j < 4; j++) pf[i][j] += pf[i - 1][j];
    }
  }
  auto okk = [&](long long m) {
    for (long long i = m; i <= n; i++) {
      vector<long long> cur = pf[n - 1];
      if (i - 1 >= 0) {
        for (long long j = 0; j < 4; j++) cur[j] -= pf[i - 1][j];
      }
      if (i - m > 0) {
        for (long long j = 0; j < 4; j++) cur[j] += pf[i - m - 1][j];
      }
      long long curx = -cur[0] + cur[1];
      long long cury = -cur[2] + cur[3];
      if (abs(x - curx) + abs(y - cury) <= m) return true;
    }
    return false;
  };
  long long l = 0, r = n, ans = 0;
  while (l <= r) {
    long long m = (l + r) / 2;
    if (okk(m)) {
      ans = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  cout << ans << '\n';
}
