#include <bits/stdc++.h>
using namespace std;
bool check(string(A), int l, int x, int y, int a, int b) {
  int c = 0, d = 0, C, D;
  for (int j = 0; j < l; j++) {
    if (A[j] == 'U') d++;
    if (A[j] == 'D') d--;
    if (A[j] == 'L') c--;
    if (A[j] == 'R') c++;
  }
  for (int i = 0; i <= A.size() - l; i++) {
    if (i > 0) {
      if (A[i - 1] == 'U') d--;
      if (A[i - 1] == 'D') d++;
      if (A[i - 1] == 'L') c++;
      if (A[i - 1] == 'R') c--;
      if (A[i + l - 1] == 'U') d++;
      if (A[i + l - 1] == 'D') d--;
      if (A[i + l - 1] == 'L') c--;
      if (A[i + l - 1] == 'R') c++;
    }
    C = a - c;
    D = b - d;
    if (abs(x - C) + abs(y - D) <= l &&
        ((abs(x - C) + abs(y - D)) % 2 == l % 2)) {
      return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string A;
  cin >> A;
  int x, y;
  cin >> x >> y;
  if (abs(x) + abs(y) > n) {
    cout << -1;
    return 0;
  }
  if ((abs(x) + abs(y)) % 2 != n % 2) {
    cout << -1;
    return 0;
  }
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] == 'U') b++;
    if (A[i] == 'D') b--;
    if (A[i] == 'L') a--;
    if (A[i] == 'R') a++;
  }
  int hi = n;
  int lo = 0;
  int mid;
  while (hi > lo) {
    mid = (hi + lo) / 2;
    if (check(A, mid, x, y, a, b)) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  cout << lo << endl;
  return 0;
}
