#include <bits/stdc++.h>
using namespace std;
char s[500000];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int len = strlen(s);
  int x, y;
  scanf("%d%d", &x, &y);
  int sum = abs(x) + abs(y);
  if ((sum > len) || (len >= sum && (len - sum) & 1 == 1)) {
    printf("-1\n");
    return 0;
  }
  int xx = 0, yy = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'L')
      xx--;
    else if (s[i] == 'R')
      xx++;
    else if (s[i] == 'U')
      yy++;
    else
      yy--;
  }
  int l = 0, r = n;
  int tx, ty;
  while (l <= r) {
    int mid = (l + r) / 2;
    tx = xx, ty = yy;
    for (int j = 0; j < mid; j++) {
      if (s[j] == 'R')
        tx--;
      else if (s[j] == 'L')
        tx++;
      else if (s[j] == 'D')
        ty++;
      else
        ty--;
    }
    sum = abs(x - tx) + abs(y - ty);
    int flag = 0;
    if (((mid >= sum) && (mid - sum) % 2 == 0)) {
      flag = 1;
    }
    for (int i = mid; i < n; i++) {
      if (s[i] == 'R')
        tx--;
      else if (s[i] == 'L')
        tx++;
      else if (s[i] == 'D')
        ty++;
      else
        ty--;
      if (s[i - mid] == 'L')
        tx--;
      else if (s[i - mid] == 'R')
        tx++;
      else if (s[i - mid] == 'U')
        ty++;
      else
        ty--;
      sum = abs(x - tx) + abs(y - ty);
      if (((mid >= sum) && (mid - sum) % 2 == 0)) {
        flag = 1;
      }
    }
    if (flag) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  printf("%d\n", l);
  return 0;
}
