#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long INFL = 1e18 + 10;
const int MAX = 2e5 + 10;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};
int n;
string s;
int x, y;
int sumx[MAX], sumy[MAX];
int getid(char c) {
  if (c == 'U')
    return 0;
  else if (c == 'D')
    return 1;
  else if (c == 'L')
    return 2;
  return 3;
}
int getsumx(int l, int r) {
  if (l > r) return 0;
  if (l == 0) return sumx[r];
  return sumx[r] - sumx[l - 1];
}
int getsumy(int l, int r) {
  if (l > r) return 0;
  if (l == 0) return sumy[r];
  return sumy[r] - sumy[l - 1];
}
bool check(int l, int r) {
  int sx = getsumx(0, l - 1) + getsumx(r + 1, n - 1);
  int sy = getsumy(0, l - 1) + getsumy(r + 1, n - 1);
  int dx = abs(x - sx), dy = abs(y - sy);
  int has = r - l + 1;
  return has >= dx + dy && (has - (dx + dy)) % 2 == 0;
}
int bfind(int p) {
  int l = p, r = n - 1, i = (l + r) / 2;
  while (l != i && i != r) {
    if (check(p, i))
      r = i;
    else
      l = i;
    i = (l + r) / 2;
  }
  for (i = l; i <= r; i++)
    if (check(p, i)) return i - p + 1;
  return INF;
}
void process() {
  cin >> n >> s >> x >> y;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      sumx[i] = sumx[i - 1];
      sumy[i] = sumy[i - 1];
    }
    sumx[i] += dx[getid(s[i])];
    sumy[i] += dy[getid(s[i])];
  }
  if (sumx[n - 1] == x && sumy[n - 1] == y) {
    cout << 0;
    return;
  }
  int res = INF;
  for (int i = 0; i < n; i++) {
    res = min(res, bfind(i));
  }
  if (res == INF)
    cout << -1;
  else
    cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  process();
}
