#include <bits/stdc++.h>
using namespace std;
const long long N = 300010;
long long n, m, T, x, y, nx, ny, l, r, ans;
long long a[N], b[N], f[N];
string s;
bool check(long long k) {
  long long xx = 0, yy = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == 'U') yy++;
    if (s[i - 1] == 'L') xx--;
    if (s[i - 1] == 'D') yy--;
    if (s[i - 1] == 'R') xx++;
    if (i > k) {
      if (s[i - 1 - k] == 'U') yy--;
      if (s[i - 1 - k] == 'L') xx++;
      if (s[i - 1 - k] == 'D') yy++;
      if (s[i - 1 - k] == 'R') xx--;
    }
    if (i >= k &&
        (long long)abs(x - (nx - xx)) + (long long)abs(y - (ny - yy)) <= k)
      return 1;
  }
  return 0;
}
int main() {
  scanf("%lld", &n);
  cin >> s;
  scanf("%lld%lld", &x, &y);
  if (abs(x) + abs(y) > n || (x + y + n) % 2 != 0) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == 'U') ny++;
    if (s[i - 1] == 'L') nx--;
    if (s[i - 1] == 'D') ny--;
    if (s[i - 1] == 'R') nx++;
  }
  if (x == nx && y == ny) {
    puts("0");
    return 0;
  }
  ans = n;
  long long l = 1, r = n;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%lld", ans);
  return 0;
}
