#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int dx8[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[] = {0, -1, 0, 1, 1, -1, 1, -1};
vector<long long> l, r, d, u;
string str;
long long x, y;
bool check(long long len) {
  if (len == 0) {
    long long cl = l.back();
    long long cr = r.back();
    long long cd = d.back();
    long long cu = u.back();
    if (cr - cl == x && cu - cd == y) return true;
    return false;
  }
  for (long long i = len - 1; i < str.size(); i++) {
    long long a = i - len + 1, b = i;
    long long cl = l.back() - l[b] + (a - 1 >= 0 ? l[a - 1] : 0);
    long long cr = r.back() - r[b] + (a - 1 >= 0 ? r[a - 1] : 0);
    long long cd = d.back() - d[b] + (a - 1 >= 0 ? d[a - 1] : 0);
    long long cu = u.back() - u[b] + (a - 1 >= 0 ? u[a - 1] : 0);
    if (abs(cr - cl - x) + abs(cu - cd - y) > len) continue;
    if ((len - abs(cr - cl - x) - abs(cu - cd - y)) % 2 != 0) continue;
    return true;
  }
  return false;
}
long long solve() {
  long long n;
  cin >> n;
  cin >> str;
  cin >> x >> y;
  if (abs(x) + abs(y) > n) return -1;
  if ((n - abs(x) - abs(y)) % 2 != 0) return -1;
  l = vector<long long>(n, 0);
  for (long long i = 0; i < str.size(); i++) {
    long long x1 = i - 1 < 0 ? 0 : l[i - 1];
    l[i] = x1 + (long long)(str[i] == 'L');
  }
  r = vector<long long>(n, 0);
  for (long long i = 0; i < str.size(); i++) {
    long long x1 = i - 1 < 0 ? 0 : r[i - 1];
    r[i] = x1 + (long long)(str[i] == 'R');
  }
  u = vector<long long>(n, 0);
  for (long long i = 0; i < str.size(); i++) {
    long long x1 = i - 1 < 0 ? 0 : u[i - 1];
    u[i] = x1 + (long long)(str[i] == 'U');
  }
  d = vector<long long>(n, 0);
  for (long long i = 0; i < str.size(); i++) {
    long long x1 = i - 1 < 0 ? 0 : d[i - 1];
    d[i] = x1 + (long long)(str[i] == 'D');
  }
  long long l1 = 0, u = str.size();
  while (l1 < u) {
    long long m = (l1 + u) / 2;
    if (check(m))
      u = m;
    else
      l1 = m + 1;
  }
  return l1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << solve() << '\n';
}
