#include <bits/stdc++.h>
using namespace std;
pair<int, int> pref[200010], suf[200010];
string s;
int X, Y;
bool check(pair<int, int> A, pair<int, int> B, int t) {
  int d = abs(X - (A.first + B.first)) + abs(Y - (A.second + B.second));
  if (t >= d && t % 2 == d % 2) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t >> s;
  cin >> X >> Y;
  for (int i = 0; i < s.size(); i++) {
    if (i) pref[i] = pref[i - 1];
    if (s[i] == 'U')
      pref[i].second++;
    else if (s[i] == 'D')
      pref[i].second--;
    else if (s[i] == 'R')
      pref[i].first++;
    else
      pref[i].first--;
  }
  suf[0] = pref[t - 1];
  for (int i = t - 1; i > 0; i--) {
    suf[i] = {pref[t - 1].first - pref[i - 1].first,
              pref[t - 1].second - pref[i - 1].second};
  }
  int ans = t, n = t;
  if (!check({0, 0}, {0, 0}, t)) {
    cout << "-1\n";
    return 0;
  }
  for (int i = 0; i < t - 1; i++) {
    for (int flag = 0; flag <= 1; flag++) {
      int l = 0, r = n;
      while (r - l > 1) {
        int mid = (r + l) >> 1;
        int p = n - flag - 2 * mid;
        if (p <= i) {
          r = mid;
          continue;
        }
        if (check(pref[i], suf[p], p - i - 1)) {
          l = mid;
        } else
          r = mid;
      }
      int p = n - flag - 2 * l;
      if (p > i && p <= n && check(pref[i], suf[p], p - i - 1))
        ans = min(ans, p - i - 1);
    }
  }
  for (int i = 0; i < t; i++) {
    if (check(pref[i], {0, 0}, t - i - 1)) ans = min(ans, t - i - 1);
  }
  for (int i = t - 1; i >= 0; i--) {
    if (check(suf[i], {0, 0}, i)) ans = min(ans, i);
  }
  cout << ans << "\n";
  return 0;
}
