#include <bits/stdc++.h>
using namespace std;
bool solve(long long l, long long n, string &s, long long x, long long y) {
  long long x1 = 0, y1 = 0;
  for (long long i = l; i < n; i++)
    if (s[i] == 'U')
      y1++;
    else if (s[i] == 'D')
      y1--;
    else if (s[i] == 'R')
      x1++;
    else
      x1--;
  for (long long i = 0; i + l - 1 < n; i++) {
    if (abs(x - x1) + abs(y - y1) <= l &&
        (abs(x - x1) + abs(y - y1) - l) % 2 == 0)
      return true;
    if (s[i] == 'U')
      y1++;
    else if (s[i] == 'D')
      y1--;
    else if (s[i] == 'R')
      x1++;
    else
      x1--;
    if (s[i + l] == 'U')
      y1--;
    else if (s[i + l] == 'D')
      y1++;
    else if (s[i + l] == 'R')
      x1--;
    else
      x1++;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, x, y, i, j;
  string s;
  cin >> n >> s >> x >> y;
  if (abs(x) + abs(y) > n)
    cout << "-1";
  else {
    long long ans = -1, l = 1, r = n;
    long long x1 = 0, y1 = 0;
    for (i = 0; i < n; i++)
      if (s[i] == 'U')
        y1++;
      else if (s[i] == 'D')
        y1--;
      else if (s[i] == 'R')
        x1++;
      else
        x1--;
    if (x == x1 && y == y1) {
      cout << 0;
      return 0;
    }
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if (solve(mid, n, s, x, y))
        ans = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    cout << ans;
  }
}
