#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 7;
const int N = 1e6 + 10;
pair<long long, long long> m[256];
string s;
int n, x, y, kq;
pair<long long, long long> d, vt;
pair<long long, long long> operator+(pair<long long, long long> u,
                                     pair<long long, long long> v) {
  return make_pair(u.first + v.first, u.second + v.second);
}
pair<long long, long long> operator-(pair<long long, long long> u,
                                     pair<long long, long long> v) {
  return make_pair(u.first - v.first, u.second - v.second);
}
long long dis(pair<long long, long long> u, pair<long long, long long> v) {
  return (abs(u.first - v.first) + abs(u.second - v.second));
}
void pre() {
  m['U'] = make_pair(0, 1);
  m['D'] = make_pair(0, -1);
  m['L'] = make_pair(-1, 0);
  m['R'] = make_pair(1, 0);
  vt = make_pair(0, 0);
  for (int i = 0; i < s.size(); i++) vt = vt + m[s[i]];
}
void xuly() {
  pre();
  if (dis(vt, d) == 0) {
    cout << 0;
    return;
  }
  if ((dis(vt, d) % 2) == 1) {
    cout << -1;
    return;
  }
  kq = n + 1;
  int l = 0;
  for (int r = 0; r <= n; r++) {
    vt = vt - m[s[r]];
    if (dis(vt, d) <= r - l + 1) {
      while (l < r) {
        if (dis(vt + m[s[l]], d) > r - l) break;
        vt = vt + m[s[l]];
        l++;
        kq = min(kq, r - l + 1);
      }
      kq = min(kq, r - l + 1);
    }
  }
  if (kq == n + 1) {
    cout << -1;
    return;
  }
  cout << kq;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  cin >> s;
  cin >> d.first >> d.second;
  xuly();
}
