#include <bits/stdc++.h>
using namespace std;
long long int X, Y, prefx[1000001], prefy[1000001], suffx[1000001],
    suffy[1000001];
long long int ok(long long int l, long long int r) {
  long long int x = prefx[l - 1];
  long long int y = prefy[l - 1];
  x += suffx[r + 1];
  y += suffy[r + 1];
  long long int z = abs(x - X) + abs(y - Y);
  if (z > r - l + 1) return 0;
  if (z == r - l + 1) return 1;
  return ((r - l + 1) - z) % 2 == 0;
}
int main() {
  ios::sync_with_stdio(false);
  ;
  cin.tie(0);
  ;
  long long int i, j, n, lo, mid, hi, ans;
  string s;
  cin >> n;
  cin >> s;
  s = " " + s;
  for (i = 1; i <= n; i++) {
    prefx[i] = prefx[i - 1];
    prefy[i] = prefy[i - 1];
    if (s[i] == 'U')
      prefy[i]++;
    else if (s[i] == 'D')
      prefy[i]--;
    else if (s[i] == 'L')
      prefx[i]--;
    else
      prefx[i]++;
  }
  for (i = n; i >= 1; i--) {
    suffx[i] = suffx[i + 1];
    suffy[i] = suffy[i + 1];
    if (s[i] == 'U')
      suffy[i]++;
    else if (s[i] == 'D')
      suffy[i]--;
    else if (s[i] == 'L')
      suffx[i]--;
    else
      suffx[i]++;
  }
  cin >> X >> Y;
  long long int x = 0, y = 0;
  for (i = 1; i <= n; i++) {
    if (s[i] == 'U')
      y++;
    else if (s[i] == 'D')
      y--;
    else if (s[i] == 'L')
      x--;
    else
      x++;
  }
  if (x == X && y == Y) {
    cout << "0";
    return 0;
  }
  ans = 1000000000000;
  for (i = 1; i <= n; i++) {
    if (!ok(i, n)) continue;
    lo = i - 1;
    hi = n;
    while (hi - lo > 1) {
      mid = (lo + hi) / 2;
      if (ok(i, mid))
        hi = mid;
      else
        lo = mid;
    }
    ans = min(ans, hi - i + 1);
  }
  if (ans == 1000000000000) ans = -1;
  cout << ans;
  return 0;
}
