#include <bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define ll long long
#define mp(a,b) make_pair(a,b)
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) printf("%d\n",n)
#define pl(n) printf("%lld\n",n)
#define newline cout << endl;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.ss<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
int main(){
//clock_t tStart = clock();
int n;
string s;
ll endx,endy;
cin >> n >> s >> endx >> endy;
ll x=0,y=0;
int cntl=0,cntr=0,cntu=0,cntd=0;
for(int i=0;i<n;i++){
if(s[i]=='U'){
y++;
cntu++;
}
if(s[i]=='D'){
y--;
cntd++;
}
if(s[i]=='R'){
x++;
cntr++;
}
if(s[i]=='L'){
x--;
cntl++;
}
}
if(x==endx && y==endy){
cout << "0\n";
}
else{
char char1,char2;
ll cnt1=-1,cnt2=-1;
bool f = 0;
if(x>endx){
char1='R';
}
else{
char1='L';
}
if(y>endy){
char2='U';
}
else{
char2='D';
}
ll diff1 = abs(x-endx);
ll diff2 = abs(y-endy);
if(diff1%2!=0 || diff2%2!=0){
f=1;
}
else{
cnt1 = diff1/2;
cnt2 = diff2/2;
}
if(char1=='L' && char2=='U'){
if(cntl<cnt1 || cntu<cnt2){
f=1;
}
}
else if(char1=='L' && char2=='D'){
if(cntl<cnt1 || cntd<cnt2){
f=1;
}
}
else if(char1=='R' && char2=='U'){
if(cntr<cnt1 || cntu<cnt2){
f=1;
}
}
else if(char1=='R' && char2=='D'){
if(cntr<cnt1 || cntd<cnt2){
f=1;
}
}
if(cnt1==0) char1='X';
if(cnt2==0) char2='X';
if(f==1){
cout << "-1\n";
return 0;
}
ll start=0,e=0,len=1e18, tc1=0,tc2=0;
while(start<n){
for(;e<n;e++){
if(tc1<cnt1 || tc2<cnt2){
if(s[e]==char1){
tc1++;
}
if(s[e]==char2){
tc2++;
}
}
else{
break;
}
}
if(tc1==cnt1 && tc2==cnt2)
len = min(len,e-start);
if(s[start]==char1) tc1--;
if(s[start]==char2) tc2--;
start++;
}
if(len==1e18) len=-1;
cout << len << endl;
}
//printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbXAoYSxiKSAgIG1ha2VfcGFpcihhLGIpCiNkZWZpbmUgbGwgICAgICAgIGxvbmcgbG9uZwojZGVmaW5lIG1wKGEsYikgICBtYWtlX3BhaXIoYSxiKQojZGVmaW5lIHNpKG4pICAgICBzY2FuZigiJWQiLCZuKQojZGVmaW5lIHNsKG4pICAgICBzY2FuZigiJWxsZCIsJm4pCiNkZWZpbmUgcGkobikgICAgIHByaW50ZigiJWRcbiIsbikKI2RlZmluZSBwbChuKSAgICAgcHJpbnRmKCIlbGxkXG4iLG4pCiNkZWZpbmUgICAgICAgICAgIG5ld2xpbmUgY291dCA8PCBlbmRsOwojZGVmaW5lICAgICAgICAgICBmZiBmaXJzdAojZGVmaW5lICAgICAgICAgICBzcyBzZWNvbmQKI2RlZmluZSAgICAgICAgICAgcGlpIHBhaXI8aW50LCBpbnQ+CiNkZWZpbmUgICAgICAgICAgIHBsbCBwYWlyPGxsLCBsbD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRlbXBsYXRlPHR5cGVuYW1lIFMsIHR5cGVuYW1lIFQ+IApvc3RyZWFtJiBvcGVyYXRvcjw8KG9zdHJlYW0mIG91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KICAgIH0KICAgIGlmKHNbaV09PSdSJyl7CiAgICAgIHgrKzsKICAgICAgY250cisrOwogICAgfQogICAgaWYoc1tpXT09J0wnKXsKICAgICAgeC0tOwogICAgICBjbnRsKys7CiAgICB9CiAgfQogIGlmKHg9PWVuZHggJiYgeT09ZW5keSl7CiAgICBjb3V0IDw8ICIwXG4iOwogIH0KICBlbHNlewogICAgY2hhciBjaGFyMSxjaGFyMjsKICAgIGxsIGNudDE9LTEsY250Mj0tMTsKICAgIGJvb2wgZiA9IDA7CiAgICBpZih4PmVuZHgpewogICAgICBjaGFyMT0nUic7CiAgICB9CiAgICBlbHNlewogICAgICBjaGFyMT0nTCc7CiAgICB9CiAgICBpZih5PmVuZHkpewogICAgICBjaGFyMj0nVSc7CiAgICB9CiAgICBlbHNlewogICAgICBjaGFyMj0nRCc7CiAgICB9CiAgICBsbCBkaWZmMSA9IGFicyh4LWVuZHgpOwogICAgbGwgZGlmZjIgPSBhYnMoeS1lbmR5KTsKICAgIGlmKGRpZmYxJTIhPTAgfHwgZGlmZjIlMiE9MCl7CiAgICAgIGY9MTsKICAgIH0KICAgIGVsc2V7CiAgICAgIGNudDEgPSBkaWZmMS8yOwogICAgICBjbnQyID0gZGlmZjIvMjsKICAgIH0KICAgIGlmKGNoYXIxPT0nTCcgJiYgY2hhcjI9PSdVJyl7CiAgICAgIGlmKGNudGw8Y250MSB8fCBjbnR1PGNudDIpewogICAgICAgIGY9MTsKICAgICAgfQogICAgfQogICAgZWxzZSBpZihjaGFyMT09J0wnICYmIGNoYXIyPT0nRCcpewogICAgICBpZihjbnRsPGNudDEgfHwgY250ZDxjbnQyKXsKICAgICAgICBmPTE7CiAgICAgIH0KICAgIH0KICAgIGVsc2UgaWYoY2hhcjE9PSdSJyAmJiBjaGFyMj09J1UnKXsKICAgICAgaWYoY250cjxjbnQxIHx8IGNudHU8Y250Mil7CiAgICAgICAgZj0xOwogICAgICB9ICAKICAgIH0KICAgIGVsc2UgaWYoY2hhcjE9PSdSJyAmJiBjaGFyMj09J0QnKXsKICAgICAgaWYoY250cjxjbnQxIHx8IGNudGQ8Y250Mil7CiAgICAgICAgZj0xOwogICAgICB9CiAgICB9CgogICAgaWYoY250MT09MCkgY2hhcjE9J1gnOwogICAgaWYoY250Mj09MCkgY2hhcjI9J1gnOwoKCiAgICBpZihmPT0xKXsKICAgICAgY291dCA8PCAiLTFcbiI7CiAgICAgIHJldHVybiAwOwogICAgfQogICAgbGwgc3RhcnQ9MCxlPTAsbGVuPTFlMTgsIHRjMT0wLHRjMj0wOwogICAgd2hpbGUoc3RhcnQ8bil7CiAgICAgIGZvcig7ZTxuO2UrKyl7CiAgICAgICAgaWYodGMxPGNudDEgfHwgdGMyPGNudDIpewogICAgICAgICAgaWYoc1tlXT09Y2hhcjEpewogICAgICAgICAgICB0YzErKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmKHNbZV09PWNoYXIyKXsKICAgICAgICAgICAgdGMyKys7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGVsc2V7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIH0KICAgICAgaWYodGMxPT1jbnQxICYmIHRjMj09Y250MikKICAgICAgICBsZW4gPSBtaW4obGVuLGUtc3RhcnQpOwogICAgICBpZihzW3N0YXJ0XT09Y2hhcjEpIHRjMS0tOwogICAgICBpZihzW3N0YXJ0XT09Y2hhcjIpIHRjMi0tOwogICAgICBzdGFydCsrOwogICAgfQogICAgaWYobGVuPT0xZTE4KSBsZW49LTE7CiAgICBjb3V0IDw8IGxlbiA8PCBlbmRsOwogIH0KICAvL3ByaW50ZigiVGltZSB0YWtlbjogJS4yZnNcbiIsIChkb3VibGUpKGNsb2NrKCkgLSB0U3RhcnQpL0NMT0NLU19QRVJfU0VDKTsKICByZXR1cm4gMDsKfQ==