#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  string s = "";
  cin >> s;
  long long o = 0, l = 0;
  vector<pair<long long, long long> > prev(n + 1);
  vector<pair<long long, long long> > left(n + 1);
  prev[0] = make_pair(o, l);
  for (long long i = 0; i < s.size(); i++) {
    switch (s[i]) {
      case 'R':
        o++;
        break;
      case 'L':
        o--;
        break;
      case 'U':
        l++;
        break;
      case 'D':
        l--;
        break;
    }
    prev[i + 1] = make_pair(o, l);
  }
  long long x, y;
  cin >> x >> y;
  left[0] = make_pair(o, l);
  for (long long i = 0; i < s.size(); i++) {
    switch (s[i]) {
      case 'R':
        o--;
        break;
      case 'L':
        o++;
        break;
      case 'U':
        l--;
        break;
      case 'D':
        l++;
        break;
    }
    left[i + 1] = make_pair(o, l);
  }
  long long lo = 0, hi = n + 1;
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    long long f = 0;
    for (long long i = 0; i < n + 1; i++) {
      pair<long long, long long> now = prev[i];
      if (i + mid <= n) {
        pair<long long, long long> after = left[i + mid];
        long long steps = abs(x - (now.first + after.first)) +
                          abs(y - (now.second + after.second));
        if (steps % 2 == mid % 2 && steps <= mid) f = 1;
      }
    }
    if (f == 1)
      hi = mid;
    else
      lo = mid + 1;
  }
  if (lo == n + 1)
    cout << -1 << "\n";
  else
    cout << lo << "\n";
}
