#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
int n;
char c[N];
pair<long long, long long> pref[N], suff[N];
long long needX, needY;
bool f(int sz) {
  for (int i = sz; i <= n; i++) {
    long long x = pref[i - sz].first + suff[i + 1].first;
    long long y = pref[i - sz].second + suff[i + 1].second;
    long long curX = pref[i].first - pref[i - sz].first;
    long long curY = pref[i].second - pref[i - sz].second;
    if (abs(x - needX) + abs(y - needY) == sz) return 1;
    if (abs(x - needX) + abs(y - needY) < sz) {
      if ((sz - (abs(x - needX) + abs(y - needY))) % 2 == 0) return 1;
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    pref[i] = pref[i - 1];
    if (c[i] == 'U')
      ++pref[i].second;
    else if (c[i] == 'D')
      --pref[i].second;
    else if (c[i] == 'L')
      --pref[i].first;
    else
      ++pref[i].first;
  }
  for (int i = n; i >= 1; i--) {
    suff[i] = suff[i + 1];
    if (c[i] == 'U')
      ++suff[i].second;
    else if (c[i] == 'D')
      --suff[i].second;
    else if (c[i] == 'L')
      --suff[i].first;
    else
      ++suff[i].first;
  }
  cin >> needX >> needY;
  int l = 0, r = n + 1;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (f(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (l == n + 1) l = -1;
  cout << l;
}
