#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, u[maxn], d[maxn], l[maxn], r[maxn];
char s[maxn];
int x, y;
int ok(int dis, int xx, int yy, int p) {
  xx += r[p + dis];
  xx -= l[p + dis];
  yy += u[p + dis];
  yy -= d[p + dis];
  xx -= x;
  yy -= y;
  xx = abs(xx);
  yy = abs(yy);
  if (xx + yy > dis) return 0;
  if ((xx + yy) % 2 != dis % 2) return 0;
  return 1;
}
int main() {
  cin >> n >> s;
  u[n + 1] = d[n + 1] = l[n + 1] = r[n + 1] = 0;
  for (int i = n; i >= 0; i--) {
    u[i] = u[i + 1];
    d[i] = d[i + 1];
    l[i] = l[i + 1];
    r[i] = r[i + 1];
    if (s[i] == 'U') u[i]++;
    if (s[i] == 'D') d[i]++;
    if (s[i] == 'L') l[i]++;
    if (s[i] == 'R') r[i]++;
  }
  cin >> x >> y;
  int xx, yy;
  xx = yy = 0;
  int ans = 1e9;
  for (int i = 0; i <= n; i++) {
    int mx = 1e9;
    int l = 0, r = n - i + 1;
    while (l < r) {
      int mid = (l + r) / 2;
      if (ok(mid, xx, yy, i)) {
        mx = mid;
        r = mid;
      } else
        l = mid + 1;
    }
    ans = min(ans, mx);
    if (s[i] == 'U') yy++;
    if (s[i] == 'D') yy--;
    if (s[i] == 'L') xx--;
    if (s[i] == 'R') xx++;
  }
  if (ans == 1e9)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
