#include <bits/stdc++.h>
using namespace std;
bool check(long long t, long long n, long long x, long long y,
           vector<long long> u, vector<long long> r) {
  for (long long i = 1; i + t - 1 <= n; ++i) {
    long long tl = abs(x - u[i - 1] - u[n] + u[i + t - 1]),
              tr = abs(y - r[i - 1] - r[n] + r[i + t - 1]);
    if (tl + tr <= t and (t - (tl + tr)) % 2 == 0) return true;
  }
  return false;
}
int32_t main() {
  long long n;
  string s;
  cin >> n >> s;
  vector<long long> u(n + 1), r(n + 1);
  for (long long i = 0; i < n; ++i) {
    char j = s[i];
    u[i + 1] = u[i];
    r[i + 1] = r[i];
    if (j == 'U')
      u[i + 1] += 1;
    else if (j == 'D')
      u[i + 1] -= 1;
    else if (j == 'R')
      r[i + 1] += 1;
    else
      r[i + 1] -= 1;
  }
  long long x, y;
  cin >> y >> x;
  if (u[n] == x and r[n] == y) {
    cout << 0 << endl;
    return 0;
  }
  long long l = 1, h = n;
  while (l < h) {
    long long mid = (l + h) / 2;
    if (check(mid, n, x, y, u, r))
      h = mid;
    else
      l = mid + 1;
  }
  cout << ((check(l, n, x, y, u, r)) ? l : -1) << endl;
}
