#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
pair<long long, long long> a[N], pref[N];
pair<long long, long long> operator+(pair<long long, long long> x,
                                     pair<long long, long long> y) {
  x.first += y.first;
  x.second += y.second;
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char cur;
    cin >> cur;
    if (cur == 'U')
      a[i] = {0, 1};
    else if (cur == 'D')
      a[i] = {0, -1};
    else if (cur == 'L')
      a[i] = {-1, 0};
    else
      a[i] = {1, 0};
  }
  long long x, y;
  cin >> x >> y;
  pref[0] = {0, 0};
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + a[i];
  }
  long long x0 = pref[n].first, y0 = pref[n].second;
  long long X = x0 - x, Y = y0 - y;
  int l = 0, r = n;
  bool ok1 = false;
  for (int i = 0; i + r <= n; i++) {
    if (abs(pref[i + r].first - pref[i].first - X) +
            abs(pref[i + r].second - pref[i].second - Y) <=
        r) {
      ok1 = true;
      break;
    }
  }
  if (!ok1) {
    cout << "-1\n";
    return 0;
  }
  if ((X + Y) % 2 != 0) {
    cout << "-1\n";
    return 0;
  }
  while (l < r) {
    int k = (l + r) / 2;
    bool ok = false;
    for (int i = 0; i + k <= n; i++) {
      if (abs(pref[i + k].first - pref[i].first - X) +
              abs(pref[i + k].second - pref[i].second - Y) <=
          k) {
        ok = true;
        break;
      }
    }
    if (ok)
      r = k;
    else
      l = k + 1;
  }
  cout << l << "\n";
  return 0;
}
