#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647, dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
const int N = 100005, M = 1000005, mod = 1000000007;
const long long llinf = 9223372036854775807ll;
int n, tx, ty, l, r, difx, dify, c[4], px, py, dif;
string s;
bool check(int m) {
  px = py = 0;
  for (int i = m; i < n; i++) {
    if (s[i] == 'U')
      py++;
    else if (s[i] == 'L')
      px--;
    else if (s[i] == 'D')
      py--;
    else
      px++;
  }
  for (int i = 0, j = m - 1; j < n - 1; i++, j++) {
    dif = abs(px - tx) + abs(py - ty);
    if (dif % 2 == m % 2 && m >= dif) return true;
    if (s[j + 1] == 'U')
      py--;
    else if (s[j + 1] == 'L')
      px++;
    else if (s[j + 1] == 'D')
      py++;
    else
      px--;
    if (s[i] == 'U')
      py++;
    else if (s[i] == 'L')
      px--;
    else if (s[i] == 'D')
      py--;
    else
      px++;
  }
  dif = abs(px - tx) + abs(py - ty);
  if (dif % 2 == m % 2 && m >= dif) return true;
  return false;
}
int main() {
  cin >> n >> s >> tx >> ty;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'U')
      c[0]++;
    else if (s[i] == 'L')
      c[1]++;
    else if (s[i] == 'D')
      c[2]++;
    else
      c[3]++;
  }
  difx = tx - c[3] + c[1];
  dify = ty - c[0] + c[2];
  if (abs(tx) + abs(ty) > n || (abs(difx) + abs(dify)) % 2 == 1) {
    cout << -1;
    return 0;
  }
  if (check(0)) {
    cout << 0;
    return 0;
  }
  if (check(1)) {
    cout << 1;
    return 0;
  }
  l = 1, r = n + 1;
  while (l < r - 1) {
    int mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  cout << r;
  return 0;
}
