#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9;
const long long INF = 1e18;
const int MAXN = 1e6 + 5;
const int MAXM = 9e4 + 500;
const int N = 1e3 + 5;
const double EPS = 1e-9;
int i, j, d;
int n, k, m;
string w;
pair<int, int> fin;
int second[MAXN], first[MAXN];
bool check(int len) {
  for (i = 1; i <= n - len + 1; i++) {
    int x0 = first[i - 1] + first[n] - first[i + len - 1];
    int y0 = second[i - 1] + second[n] - second[i + len - 1];
    int dx = abs(x0 - fin.first);
    int dy = abs(y0 - fin.second);
    if (dx + dy <= len) return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> w >> fin.first >> fin.second;
  if (abs(fin.first) + abs(fin.second) > n ||
      (abs(fin.first) + abs(fin.second)) % 2 != n % 2) {
    cout << -1;
    return 0;
  }
  for (i = 1; i <= n; i++) {
    if (w[i - 1] == 'U') second[i] = 1;
    if (w[i - 1] == 'D') second[i] = -1;
    if (w[i - 1] == 'R') first[i] = 1;
    if (w[i - 1] == 'L') first[i] = -1;
    second[i] += second[i - 1];
    first[i] += first[i - 1];
  }
  int left = -1, right = n;
  while (right - left > 1) {
    int mid = (right + left) / 2;
    if (check(mid))
      right = mid;
    else
      left = mid;
  }
  cout << right;
  return 0;
}
