#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    scanf("%d", &t);
    for(int k = 0; k < t; ++k) {
        int n;
        scanf("%d", &n);

        vector <int> myvec(n);
        for(int i = 0; i < n; i++) {
            int l;
            scanf("%d", &l);

            myvec[i] = l;
        }
        vector <int> last(200001, -1);
        int mini = 200001;
        for(int i = 0; i < n; i++) {
            int r = i;
            int l = last[myvec[r]];

            if(l != -1 && r - l + 1 < mini) {
                mini = r - l + 1;
            }
            last[myvec[i]] = i;
        }
        if(mini!=200001){
            printf("%d\n", mini);}
        else{
            printf("-1 \n");
        }
    }

    return 0;
}
    /*#include <bits/stdc++.h>

    using namespace std;

    int main()
    {
        int n, m;
        scanf("%d %d", &n, &m);
        vector <int> myvec(1000000);
        int c = 1;
        int t = 1;
        for(int i = 0; i<n;i++){
            int old_summ = c*t;
            scanf("%d %d", &c, &t);
            for(int k = old_summ; k<old_summ+c*t;k++){
                myvec[k] = i+1;
            }
        }
        for(int i = 0; i<m; i++){
            int g;
            scanf("%d", &g);
            printf("%d ", myvec[g]);
        }
        return 0;
    }
    */


#include<bits/stdc++.h>
using namespace std;

typedef vector<long int> vi;
typedef long long int lli;
int main(){
    int t;
    cin >> t;
    for(int i =0;i<t;i++){

        int n;
        cin >> n;
        vi arr;
        unordered_map<int,vi> mapping;
        for(int j=0;j<n;j++){
            long int input;
            cin >> input;
            arr.push_back(input);
            if(t==4){
                cout << input << " ";

            }
        }
        cout << endl;
        for(int p = 0; p<n;p++){
            // if(mapping.find(arr[p])!=mapping.end()){
            //     mapping[arr[p]].push_back(p);
            // }
            // else{
                mapping[arr[p]].push_back(p+1);
            // }
        }
        long int ans=2000000;
        int entering = -1;
        for(auto it= mapping.begin();it!=mapping.end();it++){
            long int val = it->first;
            vi index = it->second;
            for(int k=0;k<index.size()-1;k++){
                long int diff = index[k+1]-index[k] +1;
                // cout << diff << endl;
                if(diff<ans){
                    ans = diff;
                }
                entering=0;
                // cout << diff << " diff " << ans << " ans" <<endl;
                // cout << index[k] << " ";
            }
            // cout << val << " " << index.size() << " heck " << endl;
        }
        // cout << endl << endl;
        if(entering==-1){
            cout << entering << endl;
        }
        else{
            cout << ans << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long int lli;
int main(){
    int t;
    cin >> t;
    for(int i =0;i<t;i++){
        int n;
        cin >> n;
        vi arr;
        unordered_map<int,vi> mapping;
        for(int j=0;j<n;j++){
            int input;
            cin >> input;
            arr.push_back(input);
        }
        for(int p = 0; p<n;p++){
            // if(mapping.find(arr[p])!=mapping.end()){
            //     mapping[arr[p]].push_back(p);
            // }
            // else{
                mapping[arr[p]].push_back(p+1);
            // }
        }
        int ans=2*10^5;
        int entering = -1;
        for(auto it= mapping.begin();it!=mapping.end();it++){
            int val = it->first;
            vi index = it->second;
            for(int k=0;k<index.size()-1;k++){
                int diff = index[k+1]-index[k] +1;
                if(diff<ans){
                    ans = diff;
                }
                entering=0;
                // cout << index[k] << " ";
            }
            // cout << val << " " << index.size() << " heck " << endl;
        }
        // cout << endl << endl;
        if(entering==-1){
            cout << entering << endl;
        }
        else{
            cout << ans << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long int lli;
int main(){
    int t;
    cin >> t;
    for(int i =0;i<t;i++){
        int n;
        cin >> n;
        vi arr;
        unordered_map<int,vi> mapping;
        for(int j=0;j<n;j++){
            int input;
            cin >> input;
            arr.push_back(input);
        }
        for(int p = 0; p<n;p++){
            if(mapping.find(arr[p])!=mapping.end()){
                mapping[arr[p]].push_back(p);
            }
            else{
                mapping[arr[p]].push_back(p);
            }
        }
        int ans=2*10^5;
        int entering = -1;
        for(auto it= mapping.begin();it!=mapping.end();it++){
            int val = it->first;
            vi index = it->second;
            for(int k=0;k<index.size()-1;k++){

                int diff = index[k+1]-index[k] +1;
                if(diff<ans){
                    ans = diff;
                }
                entering=0;
                // cout << index[k] << " ";
            }
            // cout << val << "heck" << endl;
        }
        if(entering==-1){
            cout << entering << endl;
        }
        else{
            cout << ans << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector<long int> vi;
typedef long long int lli;
int main(){
    int t;
    cin >> t;
    for(int i =0;i<t;i++){
        int n;
        cin >> n;
        vi arr;
        unordered_map<int,vi> mapping;
        for(int j=0;j<n;j++){
            long int input;
            cin >> input;
            arr.push_back(input);
        }
        for(int p = 0; p<n;p++){
            // if(mapping.find(arr[p])!=mapping.end()){
            //     mapping[arr[p]].push_back(p);
            // }
            // else{
                mapping[arr[p]].push_back(p+1);
            // }
        }
        long int ans=2*10^5+1;
        int entering = -1;
        for(auto it= mapping.begin();it!=mapping.end();it++){
            long int val = it->first;
            vi index = it->second;
            for(int k=0;k<index.size()-1;k++){
                long int diff = index[k+1]-index[k] +1;
                // cout << diff << endl;
                if(diff<ans){
                    ans = diff;
                }
                entering=0;
                // cout << index[k] << " ";
            }
            // cout << val << " " << index.size() << " heck " << endl;
        }
        // cout << endl << endl;
        if(entering==-1){
            cout << entering << endl;
        }
        else{
            cout << ans << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector<long int> vi;
typedef long long int lli;
int main(){
    int t;
    cin >> t;
    for(int i =0;i<t;i++){

        int n;
        cin >> n;
        vi arr;
        unordered_map<int,vi> mapping;
        for(int j=0;j<n;j++){
            long int input;
            cin >> input;
            arr.push_back(input);
            if(i==4){
                cout << input << " ";

            }
        }
        cout << endl;
        for(int p = 0; p<n;p++){
            // if(mapping.find(arr[p])!=mapping.end()){
            //     mapping[arr[p]].push_back(p);
            // }
            // else{
                mapping[arr[p]].push_back(p+1);
            // }
        }
        long int ans=2000000;
        int entering = -1;
        for(auto it= mapping.begin();it!=mapping.end();it++){
            long int val = it->first;
            vi index = it->second;
            for(int k=0;k<index.size()-1;k++){
                long int diff = index[k+1]-index[k] +1;
                // cout << diff << endl;
                if(diff<ans){
                    ans = diff;
                }
                entering=0;
                // cout << diff << " diff " << ans << " ans" <<endl;
                // cout << index[k] << " ";
            }
            // cout << val << " " << index.size() << " heck " << endl;
        }
        // cout << endl << endl;
        if(entering==-1){
            cout << entering << endl;
        }
        else{
            cout << ans << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long int lli;
int main(){
    int t;
    cin >> t;
    for(int i =0;i<t;i++){
        int n;
        cin >> n;
        vi arr;
        unordered_map<int,vi> mapping;
        for(int j=0;j<n;j++){
            int input;
            cin >> input;
            arr.push_back(input);
        }
        for(int p = 0; p<n;p++){
            // if(mapping.find(arr[p])!=mapping.end()){
            //     mapping[arr[p]].push_back(p);
            // }
            // else{
                mapping[arr[p]].push_back(p);
            // }
        }
        int ans=2*10^5;
        int entering = -1;
        for(auto it= mapping.begin();it!=mapping.end();it++){
            int val = it->first;
            vi index = it->second;
            for(int k=0;k<index.size()-1;k++){

                int diff = index[k+1]-index[k] +1;
                if(diff<ans){
                    ans = diff;
                }
                entering=0;
                // cout << index[k] << " ";
            }
            // cout << val << " " << index.size() << " heck " << endl;
        }
        // cout << endl << endl;
        if(entering==-1){
            cout << entering << endl;
        }
        else{
            cout << ans << endl;
        }

    }

    return 0;
}


#include<iostream>
#include<string>
#include<string.h>
#include<cstring>
#include<math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<cctype>
#include<utility>
#include<set>
#include<map>
#include<sstream>
#include<iterator>
#include<limits>
#include<map>
#include<deque>
using namespace std;
#define pb push_back
#define F(i,a,b) for(int i=a;i<b;++i)
#define Fl(i,a,b) for(long long i=a;i<b;++i)
#define all(v) v.begin(), v.end()
#define X first;
#define Y second;
#define mp make_pair;
typedef long long ll;
typedef std::vector<int> vec;
typedef std::vector<long long> vecl;
typedef map<int,int> mii;
typedef std::pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MOD = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 	int t{},T{};
 	cin>>t;T=t;
 	while(t--){
        //cout<<"------------- #"<<T-t<<endl;
        ll n{},k{},a{},b{},c{10000000},s{},f{};
        cin>>n;
        vecl v(n,0);
        vecl va(n+1,-1);
        F(i,0,n)
            cin>>v[i];
        F(i,0,n){
            if(va[v[i]]==-1){
                va[v[i]]=i;
            }else{
                c=min(c,i-va[v[i]]+1);
                va[v[i]]=i;
            }
        }
        cout<<c<<endl;
    }

	return 0;
}


#include<iostream>
#include<string>
#include<string.h>
#include<cstring>
#include<math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<cctype>
#include<utility>
#include<set>
#include<map>
#include<sstream>
#include<iterator>
#include<limits>
#include<map>
#include<deque>
using namespace std;
#define pb push_back
#define F(i,a,b) for(int i=a;i<b;++i)
#define Fl(i,a,b) for(long long i=a;i<b;++i)
#define all(v) v.begin(), v.end()
#define X first;
#define Y second;
#define mp make_pair;
typedef long long ll;
typedef std::vector<int> vec;
typedef std::vector<long long> vecl;
typedef map<int,int> mii;
typedef std::pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MOD = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 	int t{},T{};
 	cin>>t;T=t;
 	while(t--){
        //cout<<"------------- #"<<T-t<<endl;
        int n{},k{},a{},b{},c{},d{1000000},f{};
        cin>>n;
        //vec z(n);
        string str;
        F(i,0,n){
            //cin>>z[i];
            cin>>a;
            str+=char(a);
        }
        if(n==1){
            d=-1;
        }else{
        F(i,0,n){
            if(i==n-1)
                break;
            if(count(all(str),str[i])>1){
                f=1;
                //a=0;b=n-1;
                a=str.find(str[i]);
                while(a!=string::npos){
                    if(a==n-1)
                        break;
                    c=a;
                    a=str.find(str[i],c+1);
                    //c=a;
                    if(a==string::npos)
                        break;
                    //cout<<a<<".";
                    if(a-c+1<=d)
                        d=a-c+1;
                }
                //cout<<"===";
                if(d==2)
                    break;
            }
        }

        }
        if(!f)
            d=-1;
        cout<<d<<endl;

    }

	return 0;
}


#include<iostream>
#include<string>
#include<string.h>
#include<cstring>
#include<math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<cctype>
#include<utility>
#include<set>
#include<map>
#include<sstream>
#include<iterator>
#include<limits>
#include<map>
#include<deque>
using namespace std;
#define pb push_back
#define F(i,a,b) for(int i=a;i<b;++i)
#define Fl(i,a,b) for(long long i=a;i<b;++i)
#define all(v) v.begin(), v.end()
#define X first;
#define Y second;
#define mp make_pair;
typedef long long ll;
typedef std::vector<int> vec;
typedef std::vector<long long> vecl;
typedef map<int,int> mii;
typedef std::pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MOD = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 	int t{},T{};
 	cin>>t;T=t;
 	while(t--){
        //cout<<"------------- #"<<T-t<<endl;
        int n{},k{},a{},b{},c{},d{1000000},f{};
        cin>>n;
        //vec z(n);
        string str;
        F(i,0,n){
            //cin>>z[i];
            cin>>a;
            str+=char(a);
        }
        if(n==1){
            d=-1;
        }else{
        F(i,0,n){
            if(count(all(str),str[i])>1){
                //a=0;b=n-1;
                a=str.find(str[i]);
                while(a!=string::npos){
                    if(a==n-1)
                        break;
                    c=a;
                    a=str.find(str[i],c+1);
                    //c=a;
                    if(a==string::npos)
                        break;
                    //cout<<a<<".";
                    if(a-c+1<=d)
                        d=a-c+1;
                }
                //cout<<"===";
                if(d==2)
                    break;
            }
        }

        }
        cout<<d<<endl;

    }

	return 0;
}


n=int(input())
s=list(input())
a,b = map(int, input().split())
L=s.count('L')
U=s.count('U')
R=s.count('R')
D=s.count('D')
x=0
y=0
xmin=0
ymin=0
minn=2*n
while x+y<2*n:
    if abs(a-(R-L))+abs(b-(U-D))>y-x and y!=n:
        i=s[y]
        if i=='L':
            L-=1
        elif i=='R':
            R-=1
        elif i=='D':
            D-=1
        elif i=='U':
            U-=1
        y+=1
    elif abs(a-(R-L))+abs(b-(U-D))<=y-x or y==n:
        if y-x<minn and abs(a-(R-L))+abs(b-(U-D))<=y-x:
            minn=y-x
        i=s[x]
        if i=='L':
            L+=1
        elif i=='R':
            R+=1
        elif i=='D':
            D+=1
        elif i=='U':
            U+=1
        x+=1

if abs(a)+abs(b)>len(s):
    print(-1)
elif (len(s)-(abs(a)+abs(b)))%2!=0:
    print(-1)
else:
    print(minn)


n = int(input())
dirs = input()
goal = list(map(int, input().split(' ')))

def can(start, end, steps):
    dist = abs(start[0] - end[0]) + abs(start[1] - end[1])
    return dist <= steps and (steps - dist) % 2 == 0

if not can((0, 0), goal, n):
    print(-1)
    exit()

diffs = {
    'U': (0, 1),
    'D': (0, -1),
    'L': (-1, 0),
    'R': (1, 0),
}

pos = [(0, 0)] + [None] * n
for i, dir in enumerate(dirs):
    old_pos = pos[i]
    diff = diffs[dir]
    pos[i+1] = (old_pos[0] + diff[0], old_pos[1] + diff[1])

final_pos = pos[n]

# best (minimum) segment to override to get to the solution
best = (abs(final_pos[0] - goal[0]) + abs(final_pos[1] - goal[1])) // 2

if best == 0:
    print(0)
    exit()

start = 0
end = best

current_best = float('inf')

while end <= n:
    # exclude segment and check if can reach without
    cur_pos = (
        pos[start][0] + final_pos[0] - pos[end][0],
        pos[start][1] + final_pos[1] - pos[end][1],
    )

    if can(cur_pos, goal, end - start):
        current_best = min(current_best, end - start)
        if current_best == best:
            break
        start += 1
    else:
        end += 1

print(current_best)

# min_steps = abs(goal[0]) + abs(goal[1])
# if min_steps > n or (min_steps - n) % 2 != 0:
#     print(-1)
#     exit()

# cur_pos = [0, 0]
# for dir in dirs:
#     if dir == 'U':
#         cur_pos[1] += 1
#     if dir == 'D':
#         cur_pos[1] -= 1
#     if dir == 'L':
#         cur_pos[0] -= 1
#     if dir == 'R':
#         cur_pos[0] += 1

# pos_diff = [goal[0] - cur_pos[0], goal[1] - cur_pos[1]]

# vertical = abs(pos_diff[1]) > abs(pos_diff[0])
# up = pos_diff[1] > 0
# right = pos_diff[0] > 0
# replacement_steps = (abs(pos_diff[0]) + abs(pos_diff[1])) // 2
# diagonal_walk = replacement_steps - \
#     abs(abs(pos_diff[1]) - abs(pos_diff[0])) // 2

# start, end = 0, 0
# covered = {'U': 0, 'D': 0, 'L': 0, 'R': 0}
# while end < n:
#     new_dir = dirs[end]
#     covered[new_dir] += 1
#     remaining = covered.copy()
#     end += 1

#     if vertical:
#         if up:
#             pass
#         else:
#             pass
#     else:
#         if right:
#             pass
#         else:
#             pass


#include <stdio.h>

#define N	200000

int abs(int a) { return a > 0 ? a : -a; }

int reachable(int x, int y, int n) {
	return abs(x) + abs(y) <= n;
}

int check(char *cc, int n, int x_, int y_, int k) {
	int i, x, y;

	x = y = 0;
	for (i = 0; i < n; i++)
		if (cc[i] == 'U')
			y++;
		else if (cc[i] == 'D')
			y--;
		else if (cc[i] == 'L')
			x--;
		else
			x++;
	for (i = 0; i < n; i++) {
		if (cc[i] == 'U')
			y--;
		else if (cc[i] == 'D')
			y++;
		else if (cc[i] == 'L')
			x++;
		else
			x--;
		if (i >= k) {
			if (cc[i - k] == 'U')
				y++;
			else if (cc[i - k] == 'D')
				y--;
			else if (cc[i - k] == 'L')
				x--;
			else
				x++;
		}
		if (i >= k - 1 && reachable(x - x_, y - y_, k))
			return 1;
	}
	return 0;
}

int main() {
	static char cc[N + 1];
	int n, x, y, lower, upper, k;

	scanf("%d%s%d%d", &n, cc, &x, &y);
	if ((n + x + y) % 2 != 0 || !reachable(x, y, n)) {
		printf("-1\n");
		return 0;
	}
	lower = -1; upper = n;
	while (upper - lower > 1) {
		k = (lower + upper) / 2;
		if (check(cc, n, x, y, k))
			upper = k;
		else
			lower = k;
	}
	printf("%d\n", upper);
	return 0;
}


#include<stdio.h>
#include<math.h>
int x[200005] = { 0 }, y[200005] = { 0 }, n;
int x_e, y_e;
char s[200005];
inline int manha(int x, int y)
{
	return abs(x - x_e) + abs(y - y_e);
}
inline int judge(int len)
{
	int i;
	for (i = len; i <= n; i++)
	{
		int mh = manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len]));
		if ((len % 2 == 0 && mh % 2 != 0) || (len % 2 != 0 && mh % 2 == 0))continue;
		if (mh <= len)return 1;
	}return 0;
}
inline int bs(int left, int right)
{
	int mid = (left + right) / 2;
	while (left < right)
	{
		if (judge(mid) == 1)
			right = mid;
		else left = mid + 1;
		mid = (left + right) / 2;
	}
	return mid <= n ? mid:-1;
}
int main()
{
	int i;
	scanf("%d %s %d %d", &n, &s[1], &x_e, &y_e);
	for (i = 1; i <= n; i++){
		x[i] += x[i - 1];
		y[i] += y[i - 1];
		if (s[i] == 'U')y[i]++;
		if (s[i] == 'D')y[i]--;
		if (s[i] == 'L')x[i]--;
		if (s[i] == 'R')x[i]++;
	}
	int l = 0, r = n+1;
	printf("%d", bs(l, r));
	return 0;
}


#include<stdio.h>
#include<math.h>
int x[200005] = { 0 }, y[200005] = { 0 }, n;
int x_e, y_e;
char s[200005];
int manha(int x, int y)
{
	return abs(x - x_e) + abs(y - y_e);
}
int judge(int len)
{
	int i;
	for (i = len; i <= n; i++)
	{
		//printf("manha=%d\n", manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len])));
		int mh = manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len]));
		if ((len % 2 == 0 && mh % 2 != 0) || (len % 2 != 0 && mh % 2 == 0))continue;
		if (mh <= len)return 1;
	}return 0;
}
int bs(int left, int right)
{
	int mid = (left + right) / 2;
	//printf("mid=%d\n", mid);
	while (left < right)
	{
		if (judge(mid) == 1)
			right = mid;
		else left = mid + 1;
		mid = (left + right) / 2;
		//printf("mid=%d\n", mid);
	}
	return mid <= n ? mid:-1;
}
int main()
{
	int i;
	scanf("%d %s %d %d", &n, &s[1], &x_e, &y_e);
	for (i = 1; i <= n; i++){
		x[i] += x[i - 1];
		y[i] += y[i - 1];
		if (s[i] == 'U')y[i]++;
		if (s[i] == 'D')y[i]--;
		if (s[i] == 'L')x[i]--;
		if (s[i] == 'R')x[i]++;
	/*	printf("-%d %d\n", x[i], y[i]);*/
	}
	int l = 0, r = n+1;
	printf("%d", bs(l, r));
	return 0;
}


#include<stdio.h>
#include<math.h>
int x[200005] = { 0 }, y[200005] = { 0 }, n;
int x_e, y_e;
char s[200005];
int manha(int x, int y)
{
	return abs(x - x_e) + abs(y - y_e);
}
int judge(int len)
{
	int i;
	for (i = len; i <= n; i++)
	{
		printf("manha=%d\n", manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len])));
		if (manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len])) <= len)return 1;
	}return 0;
}
int bs(int left, int right)
{
	int mid = (left + right) / 2;
	//printf("mid=%d\n", mid);
	while (left < right)
	{
		if (judge(mid) == 1)
			right = mid;
		else left = mid + 1;
		mid = (left + right) / 2;
		//printf("mid=%d\n", mid);
	}
	return mid <= n ? mid:-1;
}
int main()
{
	int i;
	scanf("%d %s %d %d", &n, &s[1], &x_e, &y_e);
	for (i = 1; i <= n; i++){
		x[i] += x[i - 1];
		y[i] += y[i - 1];
		if (s[i] == 'U')y[i]++;
		if (s[i] == 'D')y[i]--;
		if (s[i] == 'L')x[i]--;
		if (s[i] == 'R')x[i]++;
	}
	int l = 0, r = n+1;
	printf("%d", bs(l, r));
	return 0;
}


#include<stdio.h>
#include<math.h>
int x[200005] = { 0 }, y[200005] = { 0 }, n;
int x_e, y_e;
char s[200005];
int manha(int x, int y)
{
	return abs(x - x_e) + abs(y - y_e);
}
int judge(int len)
{
	int i;
	for (i = len; i <= n; i++)
	{
		//printf("manha=%d\n", manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len])));
		if (manha(x[n] - (x[i] - x[i - len]), y[n] - (y[i] - y[i - len])) <= len)return 1;
	}return 0;
}
int bs(int left, int right)
{
	int mid = (left + right) / 2;
	//printf("mid=%d\n", mid);
	while (left < right)
	{
		if (judge(mid) == 1)
			right = mid;
		else left = mid + 1;
		mid = (left + right) / 2;
		//printf("mid=%d\n", mid);
	}
	return mid <= n ? mid:-1;
}
int main()
{
	int i;
	scanf("%d %s %d %d", &n, &s[1], &x_e, &y_e);
	for (i = 1; i <= n; i++){
		x[i] += x[i - 1];
		y[i] += y[i - 1];
		if (s[i] == 'U')y[i]++;
		if (s[i] == 'D')y[i]--;
		if (s[i] == 'L')x[i]--;
		if (s[i] == 'R')x[i]++;
	}
	int l = 0, r = n+1;
	printf("%d", bs(l, r));
	return 0;
}


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL)

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

        let x,y; x=y=0;

        for (let i=0; i<input.length; i++) {
            switch (input.charAt(i)) {
                case 'R': x++;
                    break;
                case 'U': y++;
                    break;
                case 'D': y--;
                    break;
                case 'L': x--;
                default:
                    break;
            }
        }

        return { input: input, x: x, y: y };
    }

    function slidingSearchWindow (analysis, endCoordinates) {
        const input = analysis.input;

        // Check if we're already there ... or can't make it there
        if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y)
            return {val: '', size: 0};
        if (Math.abs(+endCoordinates.x + +endCoordinates.y)%2 != input.length%2)
            return {val: ''};

        // The minimum # of changes is the distance between the END points and "shifted" x,y points
        const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

        let minWindow = {val: ''};
        let beg = 0;
        let end = MIN_NUM_CHANGES;
        let diff;
        let x=analysis.x, y=analysis.y;

        //
        // LETS START..................
        //

        // Get initial coverage area
        for (let i=0; i<end; i++) {
            switch (input.charAt(i)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
        }

        // Start iterating through string
        while ( end > beg && !(end >= input.length+1 && end-beg >= MIN_NUM_CHANGES) ) {
            diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

            if ( (end-beg)>=diff &&  (end-beg)%diff%2 == 0 && (end-beg == 1 || diff != 1)) {
                // YES!  THIS WORKS
                if (!minWindow.size || minWindow.size > end-beg) {
                    minWindow.size = end-beg;
                    minWindow.val = input.substring(beg,end-beg);
                    if (end-beg == MIN_NUM_CHANGES) return minWindow;
                }
                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
            } else {
                if (end < input.length) {
                    end++;
                    switch (input.charAt(end-1)) {
                        case 'R': x--; break;
                        case 'U': y--; break;
                        case 'D': y++; break;
                        case 'L': x++; default: break;
                    }
                } else
                    return minWindow;
            }
        }
        return minWindow;
    }

    // END FUNCTION DEFINITIONS

    /*********************/
    // MAIN EXECUTION START
    var INPUT = 'RURUU';
    var coordinates = [-2, 3];
    INPUT = lines[1];
    coordinates = lines[2].split(' ');

    // _______ O( n ) _______
    // Analyze input -- returns object with helpful values
    let analysis = analyzeInput(INPUT);

    // _______ O( n ) _______
    // Iterate through string... sliding window approach
    // Returns: {val: 'RURU', size: 4 }
    let result = slidingSearchWindow(analysis, {x: coordinates[0], y: coordinates[1]})

    if (result.size != undefined) console.log (result.size);
    else console.log (-1);

});


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    //console.log(lines);

    /* END NODEJS READ INPUT */

const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y)
        return {val: '', size: 0};
    if (Math.abs(+endCoordinates.x + +endCoordinates.y)%2 != input.length%2)
        return {val: ''};

    // The minimum # of changes is the distance between the END points and "shifted" x,y points
    const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;
    let minWindow = {val: ''};
    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;
    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    let prev = false;
    let begHold = 0;

    DEBUG && console.log (`\t>>>>Inital:${input.substring(beg, end-beg)}, end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( end > beg && !(end >= input.length+1 && end-beg >= MIN_NUM_CHANGES) ) {

        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff} :: Goal:${endCoordinates.x},${endCoordinates.y} Curr:${x},${y}`)

        // If we can have a path to GOAL.  Check 2 things
        //  1. The number of moves is more than the difference to goal
        //  2. If we can get to GOAL in "end-beg" moves... or "end-beg-2x" for some x
        //      This is the crux of the approach.  A little mathy
        //      (Third condition keeps things clean for modding with diff
        if ( (end-beg)>=diff &&  (end-beg)%diff%2 == 0 && (end-beg == 1 || diff != 1)) {

            // YES!  THIS WORKS
            DEBUG && console.log(`\t\tYES. end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)

            // Do we have a new minimum?
            if (!minWindow.size || minWindow.size > end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                if (end-beg == MIN_NUM_CHANGES) return minWindow;
            }

            // If we can make the GOAL... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            beg++;

            // Because each "move" is a move of 2... then valid windows could go: YES, NO, YES, NO
            //  We keep track of the previous one so we can know if we should check for alternating
            prev = true;
        } else if (prev == true && (end- beg+1) >=diff && (end- (beg+1) )%diff%2 == 0 ) {
            // (Same explanation from above "prev = true")
            // If we get a NO & but the previous one was true... then it's possible we're just "one off"
            //  because of the MOD 2, and increasing beg++ will give us another YES
            DEBUG && console.log(`\t\tMAYBE. end:${end}, beg:${beg}`)

            // We "hold" the old beginning and move the other one up
            //  Will restore the old beginning if we hit 2 falses in a row (happens below)
            begHold = beg;
            beg++;
            prev = false;
        } else {
            // "NO".  There is no path to goal here

            // If we hit a false & were holding the beginning... then we reset that and keep moving
            if (begHold > 0) {
                beg = begHold;
                begHold = 0;
            }

            //
            if (end < input.length) {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next adding ${input.charAt(end)}`)
                end++;
                switch (input.charAt(end-1)) {
                    case 'R': x--; break;
                    case 'U': y--; break;
                    case 'D': y++; break;
                    case 'L': x++; default: break;
                }
            } else if (prev == false) {
                // If we have 2 false in a row... and end is at the end...
                //  then there is "forward" subset that can be found
                return minWindow;
            }/*
            else {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)

                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
            }*/

            prev = false;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end`);

    return minWindow;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

//DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

INPUT = lines[1];

const coordinates = lines[2].split(' ');

END = {x: coordinates[0], y: coordinates[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

DEBUG && console.log('Analysis:',analysis);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);
//console.log(result.length, result);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)
/* ex:
    val: 'RURU'
    size: 4
 */
if (result2.size != undefined)
    console.log (result2.size);
else
    console.log (-1);

//console.log(result2);

/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/

})


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL)

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

        let R,U,D,L;
        R=U=D=L=0;

        for (let i=0; i<input.length; i++) {
            switch (input.charAt(i)) {
                case 'R': R++;
                    break;
                case 'U': U++;
                    break;
                case 'D': D++;
                    break;
                case 'L': L++;
                default:
                    break;
            }
        }

        return {
            input: input,
            x: R-L,
            y: U-D,
            U: U,
            D: U,
            L: L,
            R: R,
            total: U+R+D+L
        };
    }

    function slidingSearchWindow (analysis, endCoordinates) {
        const input = analysis.input;

        // Check if we're already there ... or can't make it there
        if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y)
            return {val: '', size: 0};
        if (Math.abs(+endCoordinates.x + +endCoordinates.y)%2 != input.length%2)
            return {val: ''};

        // The minimum # of changes is the distance between the END points and "shifted" x,y points
        const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

        let minWindow = {val: ''};
        let beg = 0;
        let end = MIN_NUM_CHANGES;
        let diff;
        let x=analysis.x, y=analysis.y;
        let prev = false;
        let begHold = 0;

        //
        // LETS START..................
        //

        // Get initial coverage area
        for (let i=0; i<end; i++) {
            switch (input.charAt(i)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
        }

        // Start iterating through string
        while ( end > beg && !(end >= input.length+1 && end-beg >= MIN_NUM_CHANGES) ) {
            diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

            if ( (end-beg)>=diff &&  (end-beg)%diff%2 == 0 && (end-beg == 1 || diff != 1)) {
                // YES!  THIS WORKS
                if (!minWindow.size || minWindow.size > end-beg) {
                    minWindow.size = end-beg;
                    minWindow.val = input.substring(beg,end-beg);
                    if (end-beg == MIN_NUM_CHANGES) return minWindow;
                }
                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
                prev = true;
            /*} else if (prev == true && (end- beg+1) >=diff && (end- (beg+1) )%diff%2 == 0 ) {
                begHold = beg++;
                prev = false;
            */} else {
                if (begHold > 0) {
                    beg = begHold;
                    begHold = 0;
                }

                if (end < input.length) {
                    end++;
                    switch (input.charAt(end-1)) {
                        case 'R': x--; break;
                        case 'U': y--; break;
                        case 'D': y++; break;
                        case 'L': x++; default: break;
                    }
                } else if (prev == false)
                    return minWindow;

                prev = false;
            }
        }
        return minWindow;
    }

    // END FUNCTION DEFINITIONS

    /*********************/
    // MAIN EXECUTION START
    var INPUT = 'RURUU';
    var coordinates = [-2, 3];
    INPUT = lines[1];
    coordinates = lines[2].split(' ');

    // _______ O( n ) _______
    // Analyze input -- returns object with helpful values
    let analysis = analyzeInput(INPUT);

    // _______ O( n ) _______
    // Iterate through string... sliding window approach
    // Returns: {val: 'RURU', size: 4 }
    let result = slidingSearchWindow(analysis, {x: coordinates[0], y: coordinates[1]})

    if (result.size != undefined) console.log (result.size);
    else console.log (-1);

});


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL)

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

        let R,U,D,L;
        R=U=D=L=0;

        for (let i=0; i<input.length; i++) {
            switch (input.charAt(i)) {
                case 'R': R++;
                    break;
                case 'U': U++;
                    break;
                case 'D': D++;
                    break;
                case 'L': L++;
                default:
                    break;
            }
        }

        return {
            input: input,
            x: R-L,
            y: U-D,
            U: U,
            D: U,
            L: L,
            R: R,
            total: U+R+D+L
        };
    }

    function slidingSearchWindow (analysis, endCoordinates) {
        const input = analysis.input;

        // Check if we're already there ... or can't make it there
        if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y)
            return {val: '', size: 0};
        if (Math.abs(+endCoordinates.x + +endCoordinates.y)%2 != input.length%2)
            return {val: ''};

        // The minimum # of changes is the distance between the END points and "shifted" x,y points
        const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

        let minWindow = {val: ''};
        let beg = 0;
        let end = MIN_NUM_CHANGES;
        let diff;
        let x=analysis.x, y=analysis.y;

        //
        // LETS START..................
        //

        // Get initial coverage area
        for (let i=0; i<end; i++) {
            switch (input.charAt(i)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
        }

        // Start iterating through string
        while ( end > beg && !(end >= input.length+1 && end-beg >= MIN_NUM_CHANGES) ) {
            diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

            if ( (end-beg)>=diff &&  (end-beg)%diff%2 == 0 && (end-beg == 1 || diff != 1)) {
                // YES!  THIS WORKS
                if (!minWindow.size || minWindow.size > end-beg) {
                    minWindow.size = end-beg;
                    minWindow.val = input.substring(beg,end-beg);
                    if (end-beg == MIN_NUM_CHANGES) return minWindow;
                }
                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
            } else {
                if (end < input.length) {
                    end++;
                    switch (input.charAt(end-1)) {
                        case 'R': x--; break;
                        case 'U': y--; break;
                        case 'D': y++; break;
                        case 'L': x++; default: break;
                    }
                } else
                    return minWindow;
            }
        }
        return minWindow;
    }

    // END FUNCTION DEFINITIONS

    /*********************/
    // MAIN EXECUTION START
    var INPUT = 'RURUU';
    var coordinates = [-2, 3];
    INPUT = lines[1];
    coordinates = lines[2].split(' ');

    // _______ O( n ) _______
    // Analyze input -- returns object with helpful values
    let analysis = analyzeInput(INPUT);

    // _______ O( n ) _______
    // Iterate through string... sliding window approach
    // Returns: {val: 'RURU', size: 4 }
    let result = slidingSearchWindow(analysis, {x: coordinates[0], y: coordinates[1]})

    if (result.size != undefined) console.log (result.size);
    else console.log (-1);

});


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    //console.log(lines);

    /* END NODEJS READ INPUT */

const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y) return 0;

    const MIN_NUM_CHANGES = Math.ceil((Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2);

    let minWindow = {val: ''};

    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;

    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    let prev = false;
    let begHold = 0;

    DEBUG && console.log (`\t>>>>Inital:${input.substring(beg, end-beg)}, end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( end > beg && !(end >= input.length && end-beg >= MIN_NUM_CHANGES) ) {
        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff}`);

        // If we can get COVERAGE to GOAL
        DEBUG && console.log(`\t\t\tGoal:${endCoordinates.x},${endCoordinates.y} Curr:${x},${y}`)

        if ( (end-beg)>=diff && diff != 1 && (end-beg)%diff%2 == 0 ) {

            DEBUG && console.log(`\t       >YES. end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)
            if (!minWindow.size || minWindow.size > end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                //if (end-beg == MIN_NUM_CHANGES) return input.substring(beg, end - beg);
            }

            // If coverage... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            beg++;

            prev = true;
        } else if (prev == true /*&& (end- beg) >=diff*/ /*&& (end- (beg+1) )%diff%2 == 0 */) {
            // If we get a NO & but the previous one was true... then it's possible we're just "one off"
            //  because of the MOD 2, and increasing beg++ will give us another YES
            DEBUG && console.log(`\t       MAYBE. end:${end}, beg:${beg}`)
            begHold = beg;
            beg++;
            prev = false;
        } else {

            if (begHold > 0) {
                beg = begHold;
                begHold = 0;
            }

            if (end < input.length-1) {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next adding ${input.charAt(end)}`)
                end++;
                switch (input.charAt(end-1)) {
                    case 'R': x--; break;
                    case 'U': y--; break;
                    case 'D': y++; break;
                    case 'L': x++; default: break;
                }
            }
            else {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)

                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
            }

            prev = false;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end`);

    return minWindow.size >= 0 ? minWindow.size : -1;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

INPUT = lines[1];

const coordinates = lines[2].split(' ');

END = {x: coordinates[0], y: coordinates[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

DEBUG && console.log('Analysis:',analysis);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);
//console.log(result.length, result);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)
console.log(result2);

/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/

})


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    //console.log(lines);

    /* END NODEJS READ INPUT */

const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y)
        return 0;
    if ((+endCoordinates.x + +endCoordinates.y)%2 != input.length%2)
        return -1;

    // The minimum # of changes is the distance between the END points and "shifted" x,y points
    const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;
    let minWindow = {val: ''};
    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;
    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    let prev = false;
    let begHold = 0;

    DEBUG && console.log (`\t>>>>Inital:${input.substring(beg, end-beg)}, end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( end > beg && !(end >= input.length+1 && end-beg >= MIN_NUM_CHANGES) ) {

        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff} :: Goal:${endCoordinates.x},${endCoordinates.y} Curr:${x},${y}`)

        // If we can have a path to GOAL.  Check 2 things
        //  1. The number of moves is more than the difference to goal
        //  2. If we can get to GOAL in "end-beg" moves... or "end-beg-2x" for some x
        //      This is the crux of the approach.  A little mathy
        //      (Third condition keeps things clean for modding with diff
        if ( (end-beg)>=diff &&  (end-beg)%diff%2 == 0 && (end-beg == 1 || diff != 1)) {

            // YES!  THIS WORKS
            DEBUG && console.log(`\t\tYES. end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)

            // Do we have a new minimum?
            if (!minWindow.size || minWindow.size > end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                if (end-beg == MIN_NUM_CHANGES) return minWindow;
            }

            // If we can make the GOAL... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            beg++;

            // Because each "move" is a move of 2... then valid windows could go: YES, NO, YES, NO
            //  We keep track of the previous one so we can know if we should check for alternating
            prev = true;
        } else if (prev == true && (end- beg+1) >=diff && (end- (beg+1) )%diff%2 == 0 ) {
            // (Same explanation from above "prev = true")
            // If we get a NO & but the previous one was true... then it's possible we're just "one off"
            //  because of the MOD 2, and increasing beg++ will give us another YES
            DEBUG && console.log(`\t\tMAYBE. end:${end}, beg:${beg}`)

            // We "hold" the old beginning and move the other one up
            //  Will restore the old beginning if we hit 2 falses in a row (happens below)
            begHold = beg;
            beg++;
            prev = false;
        } else {
            // "NO".  There is no path to goal here

            // If we hit a false & were holding the beginning... then we reset that and keep moving
            if (begHold > 0) {
                beg = begHold;
                begHold = 0;
            }

            //
            if (end < input.length) {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next adding ${input.charAt(end)}`)
                end++;
                switch (input.charAt(end-1)) {
                    case 'R': x--; break;
                    case 'U': y--; break;
                    case 'D': y++; break;
                    case 'L': x++; default: break;
                }
            } else if (prev == false) {
                // If we have 2 false in a row... and end is at the end...
                //  then there is "forward" subset that can be found
                return minWindow;
            }/*
            else {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)

                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
            }*/

            prev = false;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end`);

    return minWindow;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

//DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

INPUT = lines[1];

const coordinates = lines[2].split(' ');

END = {x: coordinates[0], y: coordinates[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

DEBUG && console.log('Analysis:',analysis);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);
//console.log(result.length, result);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)
/* ex:
    val: 'RURU'
    size: 4
 */
if (result2.size && result2.size >= 0)
    console.log (result2.size);
else
    console.log (-1);

//console.log(result2);

/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/

})


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL)

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

        let R,U,D,L;
        R=U=D=L=0;

        for (let i=0; i<input.length; i++) {
            switch (input.charAt(i)) {
                case 'R': R++;
                    break;
                case 'U': U++;
                    break;
                case 'D': D++;
                    break;
                case 'L': L++;
                default:
                    break;
            }
        }

        return {
            input: input,
            x: R-L,
            y: U-D,
            U: U,
            D: U,
            L: L,
            R: R,
            total: U+R+D+L
        };
    }

    function slidingSearchWindow (analysis, endCoordinates) {
        const input = analysis.input;

        // Check if we're already there ... or can't make it there
        if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y)
            return {val: '', size: 0};
        if (Math.abs(+endCoordinates.x + +endCoordinates.y)%2 != input.length%2)
            return {val: ''};

        // The minimum # of changes is the distance between the END points and "shifted" x,y points
        const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

        let minWindow = {val: ''};
        let beg = 0;
        let end = MIN_NUM_CHANGES;
        let diff;
        let x=analysis.x, y=analysis.y;
        let prev = false;
        let begHold = 0;

        //
        // LETS START..................
        //

        // Get initial coverage area
        for (let i=0; i<end; i++) {
            switch (input.charAt(i)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
        }

        // Start iterating through string
        while ( end > beg && !(end >= input.length+1 && end-beg >= MIN_NUM_CHANGES) ) {
            diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

            if ( (end-beg)>=diff &&  (end-beg)%diff%2 == 0 && (end-beg == 1 || diff != 1)) {
                // YES!  THIS WORKS
                if (!minWindow.size || minWindow.size > end-beg) {
                    minWindow.size = end-beg;
                    minWindow.val = input.substring(beg,end-beg);
                    if (end-beg == MIN_NUM_CHANGES) return minWindow;
                }
                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
                prev = true;
            } else if (prev == true && (end- beg+1) >=diff && (end- (beg+1) )%diff%2 == 0 ) {
                begHold = beg++;
                prev = false;
            } else {
                if (begHold > 0) {
                    beg = begHold;
                    begHold = 0;
                }

                if (end < input.length) {
                    end++;
                    switch (input.charAt(end-1)) {
                        case 'R': x--; break;
                        case 'U': y--; break;
                        case 'D': y++; break;
                        case 'L': x++; default: break;
                    }
                } else if (prev == false)
                    return minWindow;

                prev = false;
            }
        }
        return minWindow;
    }

    // END FUNCTION DEFINITIONS

    /*********************/
    // MAIN EXECUTION START
    var INPUT = 'RURUU';
    var coordinates = [-2, 3];
    INPUT = lines[1];
    coordinates = lines[2].split(' ');

    // _______ O( n ) _______
    // Analyze input -- returns object with helpful values
    let analysis = analyzeInput(INPUT);

    // _______ O( n ) _______
    // Iterate through string... sliding window approach
    // Returns: {val: 'RURU', size: 4 }
    let result = slidingSearchWindow(analysis, {x: coordinates[0], y: coordinates[1]})

    if (result.size != undefined) console.log (result.size);
    else console.log (-1);

});


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    //console.log(lines);

    /* END NODEJS READ INPUT */

const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

    let minWindow = {val: ''};

    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;

    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);
    if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {
        // We return here because END-BEG = min number of changes
        return beg-end; //input.substring(beg, end - beg);
    }

    DEBUG && console.log (`\t>>>> #2 end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( !(end >= input.length && end-beg >= MIN_NUM_CHANGES)) {
        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff}`);

        // If we can get COVERAGE to GOAL
        if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {
            DEBUG && console.log(`\t\tYES. end:${end}, beg:${beg}`)
            if (!minWindow.size || minWindow.size < end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                if (end-beg == MIN_NUM_CHANGES) return input.substring(beg, end - beg);
            }

            // If coverage... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
            beg++;
        } else {
            DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg}`)
            // If NO coverage... then we extend from right/ end
            switch (input.charAt(end+1)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            end++;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end:${end}, beg:${beg}`);

    return minWindow.size >= 0 ? minWindow.size : -1;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

INPUT = lines[1];

const coordinates = lines[2].split(' ');

END = {x: coordinates[0], y: coordinates[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)

console.log(result2);
/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/

})


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    //console.log(lines);

    /* END NODEJS READ INPUT */

const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    if (analysis.x == endCoordinates.x && analysis.y == endCoordinates.y) return 0;

    const MIN_NUM_CHANGES = Math.ceil((Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2);

    let minWindow = {val: ''};

    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;

    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    let prev = false;
    let begHold = 0;

    DEBUG && console.log (`\t>>>>Inital:${input.substring(beg, end-beg)}, end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( end > beg && !(end >= input.length && end-beg >= MIN_NUM_CHANGES) ) {
        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff}`);

        // If we can get COVERAGE to GOAL
        DEBUG && console.log(`\t\t\tX end:${endCoordinates.x} curr:${x} - Y end:${endCoordinates.y} curr:${y}`)

        if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {

            DEBUG && console.log(`\t       >YES. end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)
            if (!minWindow.size || minWindow.size > end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                //if (end-beg == MIN_NUM_CHANGES) return input.substring(beg, end - beg);
            }

            // If coverage... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            beg++;

            prev = true;
        } else if (prev == true /*&& (end- beg) >=diff*/ /*&& (end- (beg+1) )%diff%2 == 0 */) {
            // If we get a NO & but the previous one was true... then it's possible we're just "one off"
            //  because of the MOD 2, and increasing beg++ will give us another YES
            DEBUG && console.log(`\t       MAYBE. end:${end}, beg:${beg}`)
            begHold = beg;
            beg++;
            prev = false;
        } else {

            if (begHold > 0) {
                beg = begHold;
                begHold = 0;
            }

            if (end < input.length-1) {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next adding ${input.charAt(end)}`)
                end++;
                switch (input.charAt(end-1)) {
                    case 'R': x--; break;
                    case 'U': y--; break;
                    case 'D': y++; break;
                    case 'L': x++; default: break;
                }
            }
            else {
                DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg} - next removing ${input.charAt(beg)}`)

                switch (input.charAt(beg)) {
                    case 'R': x++; break;
                    case 'U': y++; break;
                    case 'D': y--; break;
                    case 'L': x--; default: break;
                }
                beg++;
            }

            prev = false;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end`);

    return minWindow.size >= 0 ? minWindow.size : -1;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

INPUT = lines[1];

const coordinates = lines[2].split(' ');

END = {x: coordinates[0], y: coordinates[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

DEBUG && console.log('Analysis:',analysis);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);
//console.log(result.length, result);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)
console.log(result2);

/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/

})


/* NODEJS READ INPUT */
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    //console.log(lines);

    /* END NODEJS READ INPUT */

const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

    let minWindow = {val: ''};

    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;

    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);
    if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {
        // We return here because END-BEG = min number of changes
        return input.substring(beg, end - beg);
    }

    DEBUG && console.log (`\t>>>> #2 end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( !(end >= input.length && end-beg >= MIN_NUM_CHANGES)) {
        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff}`);

        // If we can get COVERAGE to GOAL
        if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {
            DEBUG && console.log(`\t\tYES. end:${end}, beg:${beg}`)
            if (!minWindow.size || minWindow.size < end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                if (end-beg == MIN_NUM_CHANGES) return input.substring(beg, end - beg);
            }

            // If coverage... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
            beg++;
        } else {
            DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg}`)
            // If NO coverage... then we extend from right/ end
            switch (input.charAt(end+1)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            end++;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end:${end}, beg:${beg}`);

    return minWindow.size >= 0 ? minWindow.size : -1;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

INPUT = lines[1];

const coordinates = lines[2].split(' ');

END = {x: coordinates[0], y: coordinates[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)

console.log(result2);
/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/

})


const DEBUG = false;

// _______ O( n ) _______
// Analyze input -- returns object with helpful values
function analyzeInput (input) {

    let R,U,D,L;
    R=U=D=L=0;

    for (let i=0; i<input.length; i++) {
        switch (input.charAt(i)) {
            case 'R': R++;
                break;
            case 'U': U++;
                break;
            case 'D': D++;
                break;
            case 'L': L++;
            default:
                break;
        }
    }

    return {
        input: input,
        x: R-L,
        y: U-D,
        U: U,
        D: U,
        L: L,
        R: R,
        total: U+R+D+L
    };
}

// _______ O( log n ) + O( evalFunction ) _______
// Binary search function
function binarySearchWindow (analysis, evalFunction, end) {
    let min = 0;
    let max = analysis.total;
    let mid = Math.floor( (min+max) / 2 );

    DEBUG && console.log(`>>> EndX: ${end.x}, EndY: ${end.y}, Min: ${min}, Max: ${max}, Mid: ${mid}, `);

    // CHECK: CHANGE 0 LETTERS
    if (end.x == analysis.x && end.y == analysis.y) return 0;

    // CHECK: CHANGE 1..N-1 LETTERS
    let finalResult = false;
    while (max-min > 1) {
        let result = evalFunction(mid, end.x, end.y, analysis);
        DEBUG && console.log('<<<', result);

        if (result) {
            finalResult = result;
            max = mid;
        } else
            min = mid;

        mid = Math.floor( (max+min)/2 );
        DEBUG && console.log(`\tmax:${max}, min:${min}, mid:${mid}`);
    }

    // CHECK: CHANGE N LETTERS
    if (!finalResult && mid == max-1) {
        finalResult = evalFunction(max, end.x, end.y, analysis);
        DEBUG && console.log('<<<', finalResult);
    }

    return finalResult || -1;
}

function slidingSearchWindow (analysis, endCoordinates) {
    const input = analysis.input;

    const MIN_NUM_CHANGES = (Math.abs(endCoordinates.x - analysis.x) + Math.abs(endCoordinates.y - analysis.y)) /2;

    let minWindow = {val: ''};

    let beg = 0;
    let end = MIN_NUM_CHANGES;
    let diff;

    let x=analysis.x, y=analysis.y;

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<end; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);
    if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {
        // We return here because END-BEG = min number of changes
        return input.substring(beg, end - beg);
    }

    DEBUG && console.log (`\t>>>> #2 end:${end}, beg:${beg}, MIN:${MIN_NUM_CHANGES}`);
    while ( !(end >= input.length && end-beg >= MIN_NUM_CHANGES)) {
        diff = Math.abs(endCoordinates.x - x) + Math.abs(endCoordinates.y - y);

        DEBUG && console.log(`\t\tDiff:${diff}`);

        // If we can get COVERAGE to GOAL
        if ( (end-beg)>=diff && (end-beg)%diff%2 == 0 ) {
            DEBUG && console.log(`\t\tYES. end:${end}, beg:${beg}`)
            if (!minWindow.size || minWindow.size < end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

                // If we're at the Minimum number of changes, then we can't do better
                if (end-beg == MIN_NUM_CHANGES) return input.substring(beg, end - beg);
            }

            // If coverage... then we shrink from left/ beginning
            switch (input.charAt(beg)) {
                case 'R': x--; break;
                case 'U': y--; break;
                case 'D': y++; break;
                case 'L': x++; default: break;
            }
            beg++;
        } else {
            DEBUG && console.log(`\t\tNO . end:${end}, beg:${beg}`)
            // If NO coverage... then we extend from right/ end
            switch (input.charAt(end+1)) {
                case 'R': x++; break;
                case 'U': y++; break;
                case 'D': y--; break;
                case 'L': x--; default: break;
            }
            end++;
        }

    }

    DEBUG && console.log (`\t<<<< #2 end:${end}, beg:${beg}`);

    return minWindow.size >= 0 ? minWindow.size : -1;

}

// _______ O( n ) _______
// Verification function
const evaluateWindowFunc = function (size, x_end, y_end, analysis) {
    const input = analysis.input;

    // NATURAL ENDING FOR WHOLE STRING
    let x = analysis.x;
    let y = analysis.y;
    let diff;

    DEBUG && console.log(`=== size:${size}, start:${x},${y} end:${x_end},${y_end}`);

    // _______ O( n ) _______
    // GET COVERAGE AREA FOR INITIAL N-SIZE BLOCK
    for (let i=0; i<size; i++) {
        switch (input.charAt(i)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
    }

    // CHECK IF FIRST LETTERS GIVE US RIGHT COVERAGE
    DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
    diff = Math.abs(x_end - x) + Math.abs(y_end - y);
    if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    // _______ O( n ) _______
    // NOW WE SHIFT RIGHT BY 1 AND THEN CHECK
    for (let i=0; i<input.length-size; i++) {
        // Remove letter behind us
        switch (input.charAt(i)) {
            case 'R': x++; break;
            case 'U': y++; break;
            case 'D': y--; break;
            case 'L': x--; default: break;
        }

        // Add letter in front of us
        switch (input.charAt(i+size)) {
            case 'R': x--; break;
            case 'U': y--; break;
            case 'D': y++; break;
            case 'L': x++; default: break;
        }
        DEBUG && console.log(`\tX.abs(${x_end} - ${x}) + Y.abs(${y_end} - ${y}) : ${Math.abs(x_end - x) + Math.abs(y_end - y)} ... ${size}`);
        diff = Math.abs(x_end - x) + Math.abs(y_end - y);
        if (size>=diff && size%diff%2 == 0) return input.substr(0,size);

    }

    return false;
}

var INPUT = 'RURUU';
var END = {x: -2, y: 3};

DEBUG && console.log(`INPUT:  ${INPUT}, GOAL:[${END.x},${END.y}]`);

const l1 = readLine();
INPUT = readLine();
const l3 = readLine().split(" ");

END = {x: l3[0], y: l3[1]};

// 1. ANALYZE INPUT - Use output for a helper object for search function
let analysis = analyzeInput(INPUT);

// 2. BINARY SEARCH THE # OF CHANGED LETTERS -- Passing evaluator function
//let result = binarySearchWindow(analysis, evaluateWindowFunc, END);

// 3. MIN WINDOW SEARCH
let result2 = slidingSearchWindow(analysis, END)

console.log(result2.length);
/*
console.log(`OUTPUT2: ${result2.length}`);
console.log(`STRING2: ${result2}`);

console.log(`OUTPUT1: ${result.length}`);
console.log(`STRING1: ${result}`);
*/