using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using SC = Scanner;

class Solver
{
    public SC sc = new SC();
    public void Solve()
    {
        var N = sc.Int;
        var S = sc.Str.ToArray();
        long X, Y;
        sc.Make(out X, out Y);
        long t = Abs(X) + Abs(Y);
        if (t % 2 != N % 2 || t > N) Fail(-1);
        var d = new Dictionary<char, int> { ['U'] = 0, ['D'] = 1, ['L'] = 2, ['R'] = 3 };
        var c = new[] { 'U', 'D', 'L', 'R' };
        var idx = Create(4, () => new List<int>());
        var ct = Create(4, () => new int[N+1]);
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                ct[j][i + 1] = ct[j][i];
            }
            ct[d[S[i]]][i + 1]++;
            idx[d[S[i]]].Add(i);
        }
        var res = int.MaxValue;
        //if (ct[0][N] - ct[1][N] == X && ct[3][N] - ct[2][N] == Y) Fail(0);
        for (int i = 0; i < N; i++)
        {
            int l = i, r = N + 1;
            while (r - l > 1)
            {
                var m = (r + l) / 2;
                int U = ct[0][m] - ct[0][i];
                var D = ct[1][m] - ct[1][i];
                var L = ct[2][m] - ct[2][i];
                var R = ct[3][m] - ct[3][i];
                var dy = Y - (idx[0].Count - U) + (idx[1].Count - D);
                var dx = X - (idx[3].Count - R) + (idx[2].Count - L);
                if ((Abs(dy) + Abs(dx)) % 2 != (m - i) % 2) throw new Exception();
                if (Abs(dy) + Abs(dx) > m - i) { l = m; }
                else r = m;
            }
            if (r == N + 1) continue;
            chmin(ref res, r - i);
        }
        Console.WriteLine(res);
    }
    #region UpperBound/LowerBound
    public static int UpperBound<T>(IList<T> array, T value, Comparison<T> cmp = null)
    {
        cmp = cmp ?? Comparer<T>.Default.Compare;
        var low = -1;
        var high = array.Count;
        while (high - low > 1)
        {
            var mid = (high + low) / 2;
            if (cmp(array[mid], value) == 1) high = mid;
            else low = mid;
        }
        return high;
    }

    public static int LowerBound<T>(IList<T> array, T value, Comparison<T> cmp = null)
    {
        cmp = cmp ?? Comparer<T>.Default.Compare;
        var low = -1;
        var high = array.Count;
        while (high - low > 1)
        {
            var mid = (high + low) / 2;
            if (cmp(array[mid], value) != -1) high = mid;
            else low = mid;
        }
        return high;
    }
    #endregion
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver();
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        sol.Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static void Out<T>(this IList<T> A, out T a) => a = A[0];
    public static void Out<T>(this IList<T> A, out T a, out T b) { a = A[0]; b = A[1]; }
    public static void Out<T>(this IList<T> A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }
    public static void Out<T>(this IList<T> A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }
    public static string Concat<T>(this IEnumerable<T> A, string sp) => string.Join(sp, A);
    public static char ToChar(this int s, char begin = '0') => (char)(s + begin);
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int ArgMax<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}

#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using SC = Scanner;

class Solver
{
    public SC sc = new SC();
    public void Solve()
    {
        var N = sc.Int;
        var S = sc.Str.ToArray();
        long X, Y;
        sc.Make(out X, out Y);
        int t = Abs(X) + Abs(Y);
        if (t % 2 != N % 2 || t > N) Fail(-1);
        var d = new Dictionary<char, int> { ['U'] = 0, ['D'] = 1, ['L'] = 2, ['R'] = 3 };
        var c = new[] { 'U', 'D', 'L', 'R' };
        var idx = Create(4, () => new List<int>());
        var ct = Create(4, () => new int[N+1]);
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                ct[j][i + 1] = ct[j][i];
            }
            ct[d[S[i]]][i + 1]++;
            idx[d[S[i]]].Add(i);
        }
        var res = int.MaxValue;
        if (ct[0][N] - ct[1][N] == X && ct[3][N] - ct[2][N] == Y) Fail(0);
        for (int i = 0; i < N; i++)
        {
            int l = i, r = N + 1;
            while (r - l > 1)
            {
                var m = (r + l) / 2;
                int U = ct[0][m] - ct[0][i];
                var D = ct[1][m] - ct[1][i];
                var L = ct[2][m] - ct[2][i];
                var R = ct[3][m] - ct[3][i];
                var dy = Y - (idx[0].Count - U) + (idx[1].Count - D);
                var dx = X - (idx[3].Count - R) + (idx[2].Count - L);
                if (Abs(dy) + Abs(dx) > m - i) { l = m; }
                else r = m;
            }
            if (r == N + 1) continue;
            chmin(ref res, r - i);
        }
        Console.WriteLine(res);
    }
    #region UpperBound/LowerBound
    public static int UpperBound<T>(IList<T> array, T value, Comparison<T> cmp = null)
    {
        cmp = cmp ?? Comparer<T>.Default.Compare;
        var low = -1;
        var high = array.Count;
        while (high - low > 1)
        {
            var mid = (high + low) / 2;
            if (cmp(array[mid], value) == 1) high = mid;
            else low = mid;
        }
        return high;
    }

    public static int LowerBound<T>(IList<T> array, T value, Comparison<T> cmp = null)
    {
        cmp = cmp ?? Comparer<T>.Default.Compare;
        var low = -1;
        var high = array.Count;
        while (high - low > 1)
        {
            var mid = (high + low) / 2;
            if (cmp(array[mid], value) != -1) high = mid;
            else low = mid;
        }
        return high;
    }
    #endregion
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver();
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        sol.Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static void Out<T>(this IList<T> A, out T a) => a = A[0];
    public static void Out<T>(this IList<T> A, out T a, out T b) { a = A[0]; b = A[1]; }
    public static void Out<T>(this IList<T> A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }
    public static void Out<T>(this IList<T> A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }
    public static string Concat<T>(this IEnumerable<T> A, string sp) => string.Join(sp, A);
    public static char ToChar(this int s, char begin = '0') => (char)(s + begin);
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int ArgMax<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}

#endregion


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace ed53c
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void process(char dir, ref int x, ref int y, bool rev = false)
        {
            var val = 1;
            if (rev)
            {
                val = -1;
            }

            if (dir == 'D')
            {
                y -= val;
            }
            else if (dir == 'U')
            {
                y += val;
            }
            else if (dir == 'R')
            {
                x += val;
            }
            else
            {
                x -= val;
            }
        }
        static void solution()
        {
            #region SOLUTION
            var n = readInt();
            var p = Console.ReadLine();
            var d = readIntArray();
            var x = d[0];
            var y = d[1];

            var needTotal = Math.Abs(x) + Math.Abs(y);
            if (needTotal > n)
            {
                Console.WriteLine("-1");
                return;
            }

            var extraTotal = n - needTotal;
            if (extraTotal % 2 == 1)
            {
                Console.WriteLine("-1");
                return;
            }

            var fX = 0;
            var fY = 0;
            for (int i = 0; i < n; i++)
            {
                if (p[i] == 'D')
                {
                    fY--;
                }
                else if (p[i] == 'U')
                {
                    fY++;
                }
                else if (p[i] == 'R')
                {
                    fX++;
                }
                else
                {
                    fX--;
                }
            }

            var l = 0;
            var r = 0;

            if (fY == y && fX == x)
            {
                Console.WriteLine("0");
                return;
            }

            process(p[0], ref fX, ref fY, rev: true);
            var min = n;

            while (true)
            {
                var can = false;
                var av = r - l + 1;
                var diffY = Math.Abs(fY - y);
                var diffX = Math.Abs(fX - x);
                if (diffX + diffY <= av)
                {
                    var extra = av - (diffX + diffY);
                    if (extra % 2 == 0)
                    {
                        min = Math.Min(min, av);

                        if (min == 1)
                        {
                            break;
                        }

                        can = true;
                    }
                }

                if (can)
                {
                    process(p[l], ref fX, ref fY, rev: false);
                    l++;
                }
                else
                {
                    if (r < n - 1)
                    {
                        r++;
                        process(p[r], ref fX, ref fY, rev: true);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            Console.WriteLine(min);

            //var needX = Math.Abs(x);
            //var needY = Math.Abs(y);

            //var haveX = new int[2];
            //var haveY = new int[2];
            //var down = 0;
            //var up = 1;
            //var left = 0;
            //var right = 1;
            //for (int i = 0; i < n; i++)
            //{
            //    if (p[i] == 'D' )
            //    {
            //        haveY[down]++;
            //    }
            //    else if (p[i] == 'U')
            //    {
            //        haveY[up]++;
            //    }
            //    else if (p[i] == 'R')
            //    {
            //        haveX[right]++;
            //    }
            //    else
            //    {
            //        haveX[left]++;
            //    }
            //}

            //if (x > 0)
            //{
            //    var changeX = Math.Min(0, haveX[right] - x) + haveX[left];

            //}

            //if (needX + needY < n)
            //{
            //    Console.WriteLine("-1");
            //    return;
            //}

            //var diffX = Math.Abs(haveX - x);
            //var diffY = Math.Abs(haveY - y);
            //if ((diffX + diffY) % 2 != 0)
            //{
            //    Console.WriteLine("-1");
            //    return;
            //}

            //var sumsX = new int[n];
            //if (diffX == diffY)
            //{

            //}

            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		if(Math.Abs(X) + Math.Abs(Y) > N){
			Console.WriteLine(-1);
			return;
		}
		if((Math.Abs(X) + Math.Abs(Y)) % 2 != N % 2){
			Console.WriteLine(-1);
			return;
		}

		int[][] sum = new int[4][];
		for(int i=0;i<4;i++){
			sum[i] = new int[N + 1];
		}

		String dir = "UDLR";
		for(int i=0;i<N;i++){
			for(int j=0;j<4;j++){
				var c = dir[j];
				sum[j][i + 1] = sum[j][i] + (S[i] == c ? 1 : 0);
			}
		}

		int min = N;
		if(sum[3][N] - sum[2][N] == X && sum[0][N] - sum[1][N] == Y){
			Console.WriteLine(0);
			return;
		}

		for(int i=0;i<=N;i++){
			int xl = sum[3][i] - sum[2][i];
			int yl = sum[0][i] - sum[1][i];

			int l = i;
			int r = N;

			if(Math.Abs(X - xl) + Math.Abs(Y - yl) > N - i) continue;
			while(r - l > 1){
				int c = (r + l) / 2;
				int xr = sum[3][N] - sum[3][c] - (sum[2][N] - sum[2][c]);
				int yr = sum[0][N] - sum[0][c] - (sum[1][N] - sum[1][c]);
				int xx = xr + xl;
				int yy = yr + yl;
				if(Math.Abs(X - xx) + Math.Abs(Y - yy) > c - i){
					l = c;
				} else {
					r = c;
				}
			}
			min = Math.Min(min, r - i);
		}

		Console.WriteLine(min);
	}
	int N;
	String S;
	int X,Y;
	public Sol(){
		N = ri();
		S = rs();
		var d = ria();
		X = d[0]; Y = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


/*
csc -debug C.cs && mono --debug C.exe <<< "5
RURUU
-2 3"
*/

using System;
using System.Collections.Generic;
using System.Linq;

public class HelloWorld {
    static public void Main () {
        SolveCodeForces();
    }

    public static int BinarySearchLeftmost<T>(IList<T> arr, Func<T, long> compare) {
        var a = 0;
        var b = arr.Count;
        while (a < b) {
            var mid = (a + b) / 2;
            var cmp = compare(arr[mid]);

            if (cmp < 0)
                a = mid + 1;
            else
                b = mid;
        }
        return a;
    }

    public static void SolveCodeForces() {
        var n = int.Parse(Console.ReadLine());
        var CMD = Console.ReadLine();
        var xy = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var x = xy[0];
        var y = xy[1];

                        //  L  R   D  U
        var cmddx = new[] { -1, 1, 0, 0 };
        var cmddy = new[] { 0, 0, -1, 1 };

        var cumX = new long[n+1];
        var cumY = new long[n+1];
        for (var i = 1; i <= n; i++) {
            var cmd = CMD[i-1];
            var cmdi = cmd == 'L' ? 0 : cmd == 'R' ? 1 : cmd == 'D' ? 2 : 3;
            cumX[i] = cumX[i-1] + cmddx[cmdi];
            cumY[i] = cumY[i-1] + cmddy[cmdi];
        }

        var L = Helpers.CreateArray(n+1, i => i);
        var bestI = 0;
        var bestLen = n+5;
        BinarySearchLeftmost(L, l => {
            for (var i = 0; i <= n - l; i++)
                if (Check(cumX, cumY, x, y, i, l)) {
                    if (i + l - 1 < bestI + bestLen - 1) {
                        bestI = i;
                        bestLen = l;
                    }
                    return 0;
                }
            return -1;
        });
        if (bestLen < n+5)
            System.Console.WriteLine(bestLen);
        else
            System.Console.WriteLine(-1);
    }

    static bool Check(long[] cumX, long[] cumY, long x, long y, int left, int len) {
        var right = left + len;

        var preX = cumX[left];
        var preY = cumY[left];

        var segX = cumX[right] - cumX[left];
        var segY = cumY[right] - cumY[left];

        var sufX = cumX[cumX.Length - 1] - cumX[right];
        var sufY = cumY[cumY.Length - 1] - cumY[right];

        var drem = Math.Abs(x - (preX + sufX)) + Math.Abs(y - (preY + sufY));

        // System.Console.WriteLine(new {
        //     left, right,
        //     pre=string.Join(",", new[] {preX, preY}),
        //     seg=string.Join(",", new[] {segX, segY}),
        //     suf=string.Join(",", new[] {sufX, sufY}),
        //     drem, len });

        return drem <= len;
    }
}

public static class Helpers {
    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }

    public static T ElementWithMax<T>(this IEnumerable<T> seq, Func<T, long> func) {
        var bi = default(T);
        var bv = long.MinValue;
        foreach (var item in seq) {
            var v = func(item);
            if (v > bv) {
                bi = item;
                bv = v;
            }
        }
        return bi;
    }

    public static IEnumerable<int> IndicesWhere<T>(this IEnumerable<T> seq, Func<T, bool> cond) {
        var i = 0;
        foreach (var item in seq) {
            if (cond(item)) yield return i;
            i++;
        }
    }
}


/*
csc -debug C.cs && mono --debug C.exe <<< "5
RURUU
-2 3"
*/

using System;
using System.Collections.Generic;
using System.Linq;

public class HelloWorld {
    static public void Main () {
        SolveCodeForces();
    }

    public static int BinarySearchLeftmost<T>(IList<T> arr, Func<T, long> compare) {
        var a = 0;
        var b = arr.Count;
        while (a < b) {
            var mid = (a + b) / 2;
            var cmp = compare(arr[mid]);

            if (cmp < 0)
                a = mid + 1;
            else
                b = mid;
        }
        return a;
    }

    public static void SolveCodeForces() {
        var n = int.Parse(Console.ReadLine());
        var CMD = Console.ReadLine();
        var xy = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var x = xy[0];
        var y = xy[1];

                        //  L  R   D  U
        var cmddx = new[] { -1, 1, 0, 0 };
        var cmddy = new[] { 0, 0, -1, 1 };

        var cumX = new long[n+1];
        var cumY = new long[n+1];
        for (var i = 1; i <= n; i++) {
            var cmd = CMD[i-1];
            var cmdi = cmd == 'L' ? 0 : cmd == 'R' ? 1 : cmd == 'D' ? 2 : 3;
            cumX[i] = cumX[i-1] + cmddx[cmdi];
            cumY[i] = cumY[i-1] + cmddy[cmdi];
        }

        var L = Helpers.CreateArray(n+1, i => i);
        var bestLen = n+5;
        BinarySearchLeftmost(L, l => {
            for (var i = 0; i <= n - l; i++)
                if (Check(cumX, cumY, x, y, i, l)) {
                    bestLen = Math.Min(bestLen, l);
                    return 0;
                }
            return -1;
        });
        if (bestLen < n+5)
            System.Console.WriteLine(bestLen);
        else
            System.Console.WriteLine(-1);
    }

    static bool Check(long[] cumX, long[] cumY, long x, long y, int left, int len) {
        var right = left + len;

        var preX = cumX[left];
        var preY = cumY[left];

        var segX = cumX[right] - cumX[left];
        var segY = cumY[right] - cumY[left];

        var sufX = cumX[cumX.Length - 1] - cumX[right];
        var sufY = cumY[cumY.Length - 1] - cumY[right];

        var drem = Math.Abs(x - (preX + sufX)) + Math.Abs(y - (preY + sufY));

        // System.Console.WriteLine(new {
        //     left, right,
        //     pre=string.Join(",", new[] {preX, preY}),
        //     seg=string.Join(",", new[] {segX, segY}),
        //     suf=string.Join(",", new[] {sufX, sufY}),
        //     drem, len });

        return drem <= len && (drem + len) % 2 == 0;
    }
}

public static class Helpers {
    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }

    public static T ElementWithMax<T>(this IEnumerable<T> seq, Func<T, long> func) {
        var bi = default(T);
        var bv = long.MinValue;
        foreach (var item in seq) {
            var v = func(item);
            if (v > bv) {
                bi = item;
                bv = v;
            }
        }
        return bi;
    }

    public static IEnumerable<int> IndicesWhere<T>(this IEnumerable<T> seq, Func<T, bool> cond) {
        var i = 0;
        foreach (var item in seq) {
            if (cond(item)) yield return i;
            i++;
        }
    }
}


#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[macro_export]
macro_rules ! chmax { ( $ x : expr , $ ( $ v : expr ) ,+ ) => { $ ( $ x = std :: cmp :: max ( $ x ,$ v ) ; ) + } ; }
#[macro_export]
macro_rules ! chmin { ( $ x : expr , $ ( $ v : expr ) ,+ ) => { $ ( $ x = std :: cmp :: min ( $ x ,$ v ) ; ) + } ; }
#[macro_export]
macro_rules ! max { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ xs : expr ) ,+ ) => { std :: cmp :: max ( $ x , max ! ( $ ( $ xs ) ,+ ) ) } ; }
#[macro_export]
macro_rules ! min { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ xs : expr ) ,+ ) => { std :: cmp :: min ( $ x , min ! ( $ ( $ xs ) ,+ ) ) } ; }
#[macro_export]
macro_rules ! dvec { ( $ t : expr ; $ len : expr ) => { vec ! [ $ t ; $ len ] } ; ( $ t : expr ; $ len : expr , $ ( $ rest : expr ) ,* ) => { vec ! [ dvec ! ( $ t ; $ ( $ rest ) ,* ) ; $ len ] } ; }
#[macro_export]
macro_rules ! cfor { ( ; $ ( $ rest : tt ) * ) => { cfor ! ( ( ) ; $ ( $ rest ) * ) } ; ( $ ( $ init : stmt ) ,+; ; $ ( $ rest : tt ) * ) => { cfor ! ( $ ( $ init ) ,+; ! false ; $ ( $ rest ) * ) } ; ( $ ( $ init : stmt ) ,+; $ cond : expr ; ; $ body : block ) => { cfor ! { $ ( $ init ) ,+; $ cond ; ( ) ; $ body } } ; ( $ ( $ init : stmt ) ,+; $ cond : expr ; $ ( $ step : expr ) ,+; $ body : block ) => { { $ ( $ init ; ) + while $ cond { let mut _first = true ; let mut _continue = false ; loop { if ! _first { _continue = true ; break } _first = false ; $ body } if ! _continue { break } $ ( $ step ; ) + } } } ; }
#[doc = " main"]
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[macro_export]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut parser = Parser :: from_str ( $ s ) ; input_inner ! { parser , $ ( $ r ) * } } ; ( parser = $ parser : ident , $ ( $ r : tt ) * ) => { input_inner ! { $ parser , $ ( $ r ) * } } ; ( new_stdin_parser = $ parser : ident , $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let reader = std :: io :: BufReader :: new ( stdin . lock ( ) ) ; let mut $ parser = Parser :: new ( reader ) ; input_inner ! { $ parser , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { input ! { new_stdin_parser = parser , $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! input_inner { ( $ parser : ident ) => { } ; ( $ parser : ident , ) => { } ; ( $ parser : ident , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ parser , $ t ) ; input_inner ! { $ parser $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! read_value { ( $ parser : ident , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ parser , $ t ) ) ,* ) } ; ( $ parser : ident , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ parser , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ parser : ident , chars ) => { read_value ! ( $ parser , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ parser : ident , usize1 ) => { read_value ! ( $ parser , usize ) - 1 } ; ( $ parser : ident , $ t : ty ) => { $ parser . next ::<$ t > ( ) . expect ( "Parse error" ) } ; }
use std::io;
use std::io::BufRead;
use std::str;
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}
impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}
impl<R: BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len, complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                if len == 0 {
                    break;
                }
                (len, buf2[len - 1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return str::from_utf8(&self.buf[begin..end]).unwrap().parse::<T>();
            } else {
                self.update_buf();
            }
        }
    }
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    input!{
        n:usize,
        s:chars,
        x:i64,y:i64,
    }
    // let sum = x+y;
    // if sum%2 != (n as i64)%2 {
    //     writeln!(out,"-1");
    //     return
    // }
    let cumxy = |l:usize,r:usize| {
        let mut x = 0;
        let mut y = 0;
        for i in l..r {
            match s[i] {
                'L' => x -= 1,
                'R' => x += 1,
                'D' => y -= 1,
                'U' => y += 1,
                _ => unreachable!(),
            }
        }
        (x,y)
    };
    let qu = |w:i64| {
        let w = w as usize;
        let mut ok = false;
        for l in 0..=n-w {
            let (x0,y0) = cumxy(0,l);
            let (x1,y1) = cumxy(l+w,n);
            let diffx = x-(x0+x1);
            let diffy = y-(y0+y1);
            // w部分を全部変えてこの差分が修正可能か？

            // パリティが同じじゃないとだめ
            if (diffx.abs()+diffy.abs())%2 == w as i64 % 2 {
                if diffx.abs() + diffy.abs() <= w as i64 {
                    ok = true;
                }
            }
        }
        ok
    };
    let mut bs = BinarySearch {
        p:qu,
        lower:0,
        upper:n as i64,
    };
    let r = bs.lower_bound();
    if r>n as i64 {
        writeln!(out,"-1");
    } else {
        writeln!(out,"{}",r);
    }
}
#[doc = "lower,upper are inclusive range"]
pub struct BinarySearch<F> {
    pub p: F,
    pub lower: i64,
    pub upper: i64,
}
impl<F: FnMut(i64) -> bool> BinarySearch<F> {
    #[doc = "O(log(upper-lower))"]
    pub fn lower_bound(&mut self) -> i64 {
        let lower = self.lower;
        let upper = self.upper;
        assert!(lower <= upper);
        let mut lb = lower - 1;
        let mut ub = upper + 1;
        while ub - lb > 1 {
            let mid = (lb + ub) / 2;
            let ok = (self.p)(mid);
            if ok {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        ub
    }
}


#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[macro_export]
macro_rules ! chmax { ( $ x : expr , $ ( $ v : expr ) ,+ ) => { $ ( $ x = std :: cmp :: max ( $ x ,$ v ) ; ) + } ; }
#[macro_export]
macro_rules ! chmin { ( $ x : expr , $ ( $ v : expr ) ,+ ) => { $ ( $ x = std :: cmp :: min ( $ x ,$ v ) ; ) + } ; }
#[macro_export]
macro_rules ! max { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ xs : expr ) ,+ ) => { std :: cmp :: max ( $ x , max ! ( $ ( $ xs ) ,+ ) ) } ; }
#[macro_export]
macro_rules ! min { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ xs : expr ) ,+ ) => { std :: cmp :: min ( $ x , min ! ( $ ( $ xs ) ,+ ) ) } ; }
#[macro_export]
macro_rules ! dvec { ( $ t : expr ; $ len : expr ) => { vec ! [ $ t ; $ len ] } ; ( $ t : expr ; $ len : expr , $ ( $ rest : expr ) ,* ) => { vec ! [ dvec ! ( $ t ; $ ( $ rest ) ,* ) ; $ len ] } ; }
#[macro_export]
macro_rules ! cfor { ( ; $ ( $ rest : tt ) * ) => { cfor ! ( ( ) ; $ ( $ rest ) * ) } ; ( $ ( $ init : stmt ) ,+; ; $ ( $ rest : tt ) * ) => { cfor ! ( $ ( $ init ) ,+; ! false ; $ ( $ rest ) * ) } ; ( $ ( $ init : stmt ) ,+; $ cond : expr ; ; $ body : block ) => { cfor ! { $ ( $ init ) ,+; $ cond ; ( ) ; $ body } } ; ( $ ( $ init : stmt ) ,+; $ cond : expr ; $ ( $ step : expr ) ,+; $ body : block ) => { { $ ( $ init ; ) + while $ cond { let mut _first = true ; let mut _continue = false ; loop { if ! _first { _continue = true ; break } _first = false ; $ body } if ! _continue { break } $ ( $ step ; ) + } } } ; }
#[doc = " main"]
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[macro_export]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut parser = Parser :: from_str ( $ s ) ; input_inner ! { parser , $ ( $ r ) * } } ; ( parser = $ parser : ident , $ ( $ r : tt ) * ) => { input_inner ! { $ parser , $ ( $ r ) * } } ; ( new_stdin_parser = $ parser : ident , $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let reader = std :: io :: BufReader :: new ( stdin . lock ( ) ) ; let mut $ parser = Parser :: new ( reader ) ; input_inner ! { $ parser , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { input ! { new_stdin_parser = parser , $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! input_inner { ( $ parser : ident ) => { } ; ( $ parser : ident , ) => { } ; ( $ parser : ident , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ parser , $ t ) ; input_inner ! { $ parser $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! read_value { ( $ parser : ident , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ parser , $ t ) ) ,* ) } ; ( $ parser : ident , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ parser , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ parser : ident , chars ) => { read_value ! ( $ parser , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ parser : ident , usize1 ) => { read_value ! ( $ parser , usize ) - 1 } ; ( $ parser : ident , $ t : ty ) => { $ parser . next ::<$ t > ( ) . expect ( "Parse error" ) } ; }
use std::io;
use std::io::BufRead;
use std::str;
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}
impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}
impl<R: BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len, complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                if len == 0 {
                    break;
                }
                (len, buf2[len - 1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return str::from_utf8(&self.buf[begin..end]).unwrap().parse::<T>();
            } else {
                self.update_buf();
            }
        }
    }
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    input!{
        n:usize,
        s:chars,
        x:i64,y:i64,
    }
    // let sum = x+y;
    // if sum%2 != (n as i64)%2 {
    //     writeln!(out,"-1");
    //     return
    // }

    let mut L = vec![0;n];
    let mut R = vec![0;n];
    let mut D = vec![0;n];
    let mut U = vec![0;n];

    for i in 0..n {
        match s[i] {
            'L' => L[i] = 1,
            'R' => R[i] = 1,
            'D' => D[i] = 1,
            'U' => U[i] = 1,
            _ => unreachable!(),
        }
    }
    let cumL = cumsum1(L);
    let cumR = cumsum1(R);
    let cumD = cumsum1(D);
    let cumU = cumsum1(U);

    let cumxy = |l:usize,r:usize| {
        let mut x = 0;
        let mut y = 0;
        x -= cumL.query(l, r);
        x += cumR.query(l, r);
        y -= cumD.query(l, r);
        y += cumU.query(l, r);
        (x,y)
    };
    let qu = |w:i64| {
        let w = w as usize;
        let mut ok = false;
        for l in 0..=n-w {
            let (x0,y0) = cumxy(0,l);
            let (x1,y1) = cumxy(l+w,n);
            let diffx = x-(x0+x1);
            let diffy = y-(y0+y1);
            // w部分を全部変えてこの差分が修正可能か？

            // パリティが同じじゃないとだめ
            if (diffx.abs()+diffy.abs())%2 == w as i64 % 2 {
                if diffx.abs() + diffy.abs() <= w as i64 {
                    ok = true;
                }
            }
        }
        ok
    };
    let mut bs = BinarySearch {
        p:qu,
        lower:0,
        upper:n as i64,
    };
    let r = bs.lower_bound();
    if r>n as i64 {
        writeln!(out,"-1");
    } else {
        writeln!(out,"{}",r);
    }
}
#[doc = "lower,upper are inclusive range"]
pub struct BinarySearch<F> {
    pub p: F,
    pub lower: i64,
    pub upper: i64,
}
impl<F: FnMut(i64) -> bool> BinarySearch<F> {
    #[doc = "O(log(upper-lower))"]
    pub fn lower_bound(&mut self) -> i64 {
        let lower = self.lower;
        let upper = self.upper;
        assert!(lower <= upper);
        let mut lb = lower - 1;
        let mut ub = upper + 1;
        while ub - lb > 1 {
            let mid = (lb + ub) / 2;
            let ok = (self.p)(mid);
            if ok {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        ub
    }
}
struct CumSum1 {
    base: Vec<i64>,
    dp: Vec<i64>,
}
impl CumSum1 {
    fn new(n: usize) -> CumSum1 {
        CumSum1 {
            base: vec![0; n],
            dp: vec![],
        }
    }
    fn add(&mut self, i: usize, x: i64) {
        self.base[i] += x;
    }
    fn set(&mut self, i: usize, x: i64) {
        self.base[i] = x;
    }
    fn build(&mut self) {
        let n = self.base.len();
        let mut dp = vec![0; n + 1];
        let mut acc = 0;
        for i in 0..n {
            acc += self.base[i];
            dp[i + 1] = acc;
        }
        self.dp = dp;
    }
    #[doc = "[i,j)"]
    fn query(&self, i: usize, j: usize) -> i64 {
        self.dp[j] - self.dp[i]
    }
}
fn cumsum1(a: Vec<i64>) -> CumSum1 {
    let mut x = CumSum1::new(a.len());
    for i in 0..a.len() {
        x.set(i, a[i]);
    }
    x.build();
    x
}


/** STANDARD SECTION **/
mod util {

use std;
pub fn read_line() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    String::from(buffer.trim_right())
}
#[allow(dead_code)]
pub fn read_ascii() -> Vec<u8> {
    let line = read_line();
    debug_assert!(line.is_ascii());
    line.bytes().collect()
}
#[allow(dead_code)]
pub fn read1() -> i64 {
    read_line().parse::<i64>().unwrap()
}
#[allow(dead_code)]
fn read_nums<T: std::str::FromStr>() -> Vec<T>
    where <T as std::str::FromStr>::Err : std::fmt::Debug {
    read_line().split(' ').map(|x| x.parse::<T>().unwrap()).collect()
}
#[allow(dead_code)]
pub fn read_ints() -> Vec<i64> {
    read_nums::<i64>()
}
#[allow(dead_code)]
pub fn read_floats() -> Vec<f64> {
    read_nums::<f64>()
}
#[allow(dead_code)]
pub fn read2() -> (i64, i64) {
    let nums = read_ints();
    (nums[0], nums[1])
}
#[allow(dead_code)]
pub fn read3() -> (i64, i64, i64) {
    let nums = read_ints();
    (nums[0], nums[1], nums[2])
}
#[allow(dead_code)]
pub fn read4() -> (i64, i64, i64, i64) {
    let nums = read_ints();
    (nums[0], nums[1], nums[2], nums[3])
}
#[allow(dead_code)]
pub fn print_vec(vec: &Vec<i64>) {
    for &i in vec.iter() {
        print!("{} ", i);
    }
    println!();
}

} // mod util
use util::*;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::process::exit;
/** End of STANDARD SECTION **/

trait MinAnswerBinarySearch {
    /// Required to return values monotonically on (left, right).
    fn check(&self, value: i64) -> bool;
    /// Provided function for returning answer.
    /// `self.check(left) == false, self.check(right) == true`
    /// This must be true semantically, check is only defined on (left, right).
    fn answer(&self, mut left: i64, mut right: i64) -> i64 {
        while right - left > 1 {
            let mid = (right + left) / 2;
            if self.check(mid) {
                right = mid;
            } else {
                left = mid;
            }
        }
        right
    }
}

#[derive(Default)]
struct Problem {
    n: i64,
    st: Vec<u8>,
    x: i64,
    y: i64,
    vec_head: Vec<(i64, i64)>,
    vec_tail: Vec<(i64, i64)>,
}

impl Problem {
    fn init(&mut self) {
        self.n = read1();
        self.st = read_ascii();
        let (x, y) = read2();
        self.x = x; self.y = y;
        if (self.x + self.y + self.st.len() as i64) % 2 == 1 {
            println!("-1");
            exit(0);
        }

        let mut curr = (0, 0);
        self.vec_head.push(curr);
        for &ltr in self.st.iter() {
            let (dx, dy) = match ltr {
                b'U' => (0, 1),
                b'D' => (0, -1),
                b'L' => (-1, 0),
                b'R' => (1, 0),
                _ => unreachable!(),
            };
            curr = (curr.0 + dx, curr.1 + dy);
            self.vec_head.push(curr);
        }

        let mut curr = (self.x, self.y);
        self.vec_tail.push(curr);
        for &ltr in self.st.iter().rev() {
            let (dx, dy) = match ltr {
                b'D' => (0, 1),
                b'U' => (0, -1),
                b'R' => (-1, 0),
                b'L' => (1, 0),
                _ => unreachable!(),
            };
            curr = (curr.0 + dx, curr.1 + dy);
            self.vec_tail.push(curr);
        }
    }
}

impl MinAnswerBinarySearch for Problem {
    fn check(&self, value: i64) -> bool {
        // println!("Value: {}", value);
        self.vec_head.iter().zip(
            self.vec_tail.iter().skip((self.n - value) as usize))//.inspect(|x| println!("{:?}", x) )
            .map(|(&(x1, y1), &(x2, y2))| (x1 - x2).abs() + (y1 - y2).abs()).min().unwrap() <= value
    }
}

fn main() {
    let mut prob = Problem::default();
    prob.init();
    let ans = prob.answer(-1, prob.n + 1);
    println!("{}", if ans > prob.n { -1 } else { ans });
}


/** STANDARD SECTION **/
mod util {

use std;
pub fn read_line() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    String::from(buffer.trim_right())
}
#[allow(dead_code)]
pub fn read_ascii() -> Vec<u8> {
    let line = read_line();
    debug_assert!(line.is_ascii());
    line.bytes().collect()
}
#[allow(dead_code)]
pub fn read1() -> i64 {
    read_line().parse::<i64>().unwrap()
}
#[allow(dead_code)]
fn read_nums<T: std::str::FromStr>() -> Vec<T>
    where <T as std::str::FromStr>::Err : std::fmt::Debug {
    read_line().split(' ').map(|x| x.parse::<T>().unwrap()).collect()
}
#[allow(dead_code)]
pub fn read_ints() -> Vec<i64> {
    read_nums::<i64>()
}
#[allow(dead_code)]
pub fn read_floats() -> Vec<f64> {
    read_nums::<f64>()
}
#[allow(dead_code)]
pub fn read2() -> (i64, i64) {
    let nums = read_ints();
    (nums[0], nums[1])
}
#[allow(dead_code)]
pub fn read3() -> (i64, i64, i64) {
    let nums = read_ints();
    (nums[0], nums[1], nums[2])
}
#[allow(dead_code)]
pub fn read4() -> (i64, i64, i64, i64) {
    let nums = read_ints();
    (nums[0], nums[1], nums[2], nums[3])
}
#[allow(dead_code)]
pub fn print_vec(vec: &Vec<i64>) {
    for &i in vec.iter() {
        print!("{} ", i);
    }
    println!();
}

} // mod util
use util::*;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::process::exit;
/** End of STANDARD SECTION **/

trait MinAnswerBinarySearch {
    /// Required to return values monotonically on (left, right).
    fn check(&self, value: i64) -> bool;
    /// Provided function for returning answer.
    /// `self.check(left) == false, self.check(right) == true`
    /// This must be true semantically, check is only defined on (left, right).
    fn answer(&self, mut left: i64, mut right: i64) -> i64 {
        while right - left > 1 {
            let mid = (right + left) / 2;
            if self.check(mid) {
                right = mid;
            } else {
                left = mid;
            }
        }
        right
    }
}

#[derive(Default)]
struct Problem {
    n: i64,
    st: Vec<u8>,
    x: i64,
    y: i64,
    vec_head: Vec<(i64, i64)>,
    vec_tail: Vec<(i64, i64)>,
}

impl Problem {
    fn init(&mut self) {
        self.n = read1();
        self.st = read_ascii();
        let (x, y) = read2();
        self.x = x; self.y = y;
        if (self.x + self.y + self.st.len() as i64) % 2 == 1 {
            println!("-1");
            exit(0);
        }

        let mut curr = (0, 0);
        self.vec_head.push(curr);
        for &ltr in self.st.iter() {
            let (dx, dy) = match ltr {
                b'U' => (0, 1),
                b'D' => (0, -1),
                b'L' => (-1, 0),
                b'R' => (1, 0),
                _ => unreachable!(),
            };
            curr = (curr.0 + dx, curr.1 + dy);
            self.vec_head.push(curr);
        }

        let mut curr = (self.x, self.y);
        self.vec_tail.push(curr);
        for &ltr in self.st.iter().rev() {
            let (dx, dy) = match ltr {
                b'D' => (0, 1),
                b'U' => (0, -1),
                b'R' => (-1, 0),
                b'L' => (1, 0),
                _ => unreachable!(),
            };
            curr = (curr.0 + dx, curr.1 + dy);
            self.vec_tail.push(curr);
        }
    }
}

impl MinAnswerBinarySearch for Problem {
    fn check(&self, value: i64) -> bool {
        // println!("Value: {}", value);
        self.vec_head.iter().zip(
            self.vec_tail.iter().rev().skip(value as usize))//.inspect(|x| println!("{:?}", x) )
            .map(|(&(x1, y1), &(x2, y2))| (x1 - x2).abs() + (y1 - y2).abs()).min().unwrap() <= value
    }
}

fn main() {
    let mut prob = Problem::default();
    prob.init();
    let ans = prob.answer(-1, prob.n + 1);
    println!("{}", if ans > prob.n { -1 } else { ans });
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	_ "reflect"
)

// input optimization
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

type pos struct {
	x int
	y int
}

// globals

var end pos
var s string

// solution
func abs(i int) int {
	return int(math.Abs(float64(i)))
}

func (cur pos) String() string {
	return fmt.Sprintf("x: %v, y: %v\n", cur.x, cur.y)
}

func (cur *pos) update(mv rune, d int) {
	switch mv {
	case 'U':
		cur.y += d
	case 'D':
		cur.y -= d
	case 'L':
		cur.x -= d
	case 'R':
		cur.x += d
	}
}

func can(start, end pos, l int) bool {
	d := abs(start.x-end.x) + abs(start.y-end.y)
	if d%2 != l%2 {
		return false
	}
	return l >= d
}

func ok(length int) bool {
	p := pos{0, 0}
	for _, value := range s[length:] {
		p.update(value, 1)
	}

	l, r := 0, length

	for {
		if can(p, end, length) {
			return true
		}

		if r == len(s) {
			break
		}
		p.update(rune(s[l]), 1)
		l++
		p.update(rune(s[r]), -1)
		r++
	}

	return false
}

func solution() int {
	if !ok(len(s)) {
		return -1
	}

	l, r := -1, len(s)
	for r-l > 1 {
		mid := (l + r) / 2
		if ok(mid) {
			r = mid
		} else {
			l = mid
		}
	}
	return r
}

func main() {
	//STDOUT MUST BE FLUSHED MANUALLY
	defer writer.Flush()

	var n, x, y int
	scanf("%d\n", &n)
	scanf("%s\n", &s)
	scanf("%d %d\n", &x, &y)
	end = pos{x, y}
	printf("%d\n", solution())
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	_ "reflect"
)

// input optimization
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

type pos struct {
	x int
	y int
}

// globals

var end pos
var s string

// solution
func abs(i int) int {
	return int(math.Abs(float64(i)))
}

func (cur pos) String() string {
	return fmt.Sprintf("x: %v, y: %v\n", cur.x, cur.y)
}

func (cur *pos) update(mv rune, d int) {
	switch mv {
	case 'U':
		cur.y += d
	case 'D':
		cur.y -= d
	case 'L':
		cur.x -= d
	case 'R':
		cur.x += d
	}
}

func can(start, end pos, len int) bool {
	d := abs(start.x-end.x) + abs(start.y-end.y)
	if d%2 != len%2 {
		return false
	}
	return len >= d
}

func ok(length int) bool {
	p := pos{0, 0}
	for _, value := range s[length:] {
		p.update(value, 1)
	}

	l, r := 0, length

	for {
		if can(p, end, length) {
			return true
		}

		if r == len(s) {
			break
		}
		p.update(rune(s[l]), 1)
		l++
		p.update(rune(s[r]), -1)
		r++
	}

	return false
}

func solution() int {
	if !ok(len) {
		return -1
	}

	l, r := -1, len(s)
	for r-l > 1 {
		mid := (l + r) / 2
		if ok(mid) {
			r = mid
		} else {
			l = mid
		}
	}
	return r
}

func main() {
	//STDOUT MUST BE FLUSHED MANUALLY
	defer writer.Flush()

	var n, x, y int
	scanf("%d\n", &n)
	scanf("%s\n", &s)
	scanf("%d %d\n", &x, &y)
	end = pos{x, y}
	printf("%d\n", solution(len(s)))
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	_ "reflect"
)

// input optimization
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

type pos struct {
	x int
	y int
}

// globals

var end pos
var s string

// solution
func abs(i int) int {
	return int(math.Abs(float64(i)))
}

func (cur pos) String() string {
	return fmt.Sprintf("x: %v, y: %v\n", cur.x, cur.y)
}

func (cur *pos) update(mv rune, d int) {
	switch mv {
	case 'U':
		cur.y += d
	case 'D':
		cur.y -= d
	case 'L':
		cur.x -= d
	case 'R':
		cur.x += d
	}
}

func can(start, end pos, len int) bool {
	d := abs(start.x-end.x) + abs(start.y-end.y)
	if d%2 != len%2 {
		return false
	}
	return len >= d
}

func ok(length int) bool {
	p := pos{0, 0}
	for _, value := range s[length:] {
		p.update(value, 1)
	}

	l, r := 0, length

	for {
		if can(p, end, length) {
			return true
		}

		if r == len(s) {
			break
		}
		p.update(rune(s[l]), 1)
		l++
		p.update(rune(s[r]), 1)
		r++
	}

	return false
}

func solution(len int) int {
	if !ok(len) {
		printf("cannot reach!\n")
		return -1
	}

	l, r := -1, len
	for r-l > 1 {
		mid := (l + r) / 2
		if ok(mid) {
			r = mid
		} else {
			l = mid
		}
	}
	return r
}

func main() {
	//STDOUT MUST BE FLUSHED MANUALLY
	defer writer.Flush()

	var n, x, y int
	scanf("%d\n", &n)
	scanf("%s\n", &s)
	scanf("%d %d\n", &x, &y)
	end = pos{x, y}
	printf("%d\n", solution(len(s)))
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	_ "reflect"
)

// input optimization
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

type pos struct {
	x int
	y int
}

// globals

var end pos
var s string

// solution
func abs(i int) int {
	return int(math.Abs(float64(i)))
}

func (cur pos) String() string {
	return fmt.Sprintf("x: %v, y: %v\n", cur.x, cur.y)
}

func (cur *pos) update(mv rune, d int) {
	switch mv {
	case 'U':
		cur.y += d
	case 'D':
		cur.y -= d
	case 'L':
		cur.x -= d
	case 'R':
		cur.x += d
	}
}

func can(start, end pos, len int) bool {
	d := abs(start.x-end.x) + abs(start.y-end.y)
	if d%2 != len%2 {
		return false
	}
	return len >= d
}

func ok(length int) bool {
	p := pos{0, 0}
	for _, value := range s[length:] {
		p.update(value, 1)
	}

	l, r := 0, length

	for {
		if can(p, end, length) {
			return true
		}

		if r == len(s) {
			break
		}
		p.update(rune(s[l]), 1)
		l++
		p.update(rune(s[r]), 1)
		r++
	}

	return false
}

func solution(len int) int {
	if !ok(len) {
		return -1
	}

	l, r := -1, len
	for r-l > 1 {
		mid := (l + r) / 2
		if ok(mid) {
			r = mid
		} else {
			l = mid
		}
	}
	return r
}

func main() {
	//STDOUT MUST BE FLUSHED MANUALLY
	defer writer.Flush()

	var n, x, y int
	scanf("%d\n", &n)
	scanf("%s\n", &s)
	scanf("%d %d\n", &x, &y)
	end = pos{x, y}
	printf("%d\n", solution(len(s)))
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	X := io.NextInt()
	Y := io.NextInt()

	if N % 2 != Abs(X + Y) % 2 {
		io.Println(-1)
		return
	}

	L := 0
	R := N
	good := N
	for L <= R {
		M := (L + R) >> 1
		if can(S, M, X, Y) {
			R = M - 1
			good = M
		} else {
			L = M + 1
		}
	}
	io.Println(good)

	// want := make(map[rune]int)
	// want['U'] = Max(0, dy - Y)
	// want['D'] = Max(0, Y - dy)
	// want['L'] = Max(0, X - dx)
	// want['R'] = Max(0, dx - X)
	// for k, v := range want {
	// 	if (v & 1) != 0 {
	// 		io.Println(-1)
	// 		return
	// 	}
	// 	want[k] >>= 1
	// }

	// A := []rune(S + "#")
	// lo := 0
	// hi := 0
	// have := make(map[rune]int)
	// best := N
	// for hi <= N {
	// 	if isGood(have, want) {
	// 		best = Min(best, hi - lo)
	// 		have[A[lo]]--
	// 		lo++
	// 	} else {
	// 		have[A[hi]]++
	// 		hi++
	// 	}
	// }
	// io.Println(best)
}

func can(S string, W, X, Y int) bool {
	N := len(S)
	x0, y0 := where(S[W:])
	A := []rune(S + "#")
	for i := W; i <= N; i++ {
		if Abs(x0 - X) + Abs(y0 - Y) <= W {
			return true
		}
		dxl, dyl := change(A[i-W])
		dxr, dyr := change(A[i])
		x0 += dxl - dxr
		y0 += dyl - dyr
	}
	return false
}

func where(S string) (int, int) {
	x := 0
	y := 0
	for _, c := range S {
		dx, dy := change(c)
		x += dx
		y += dy
	}
	return x, y
}

func change(c rune) (int, int) {
	switch c {
	case 'U':
		return 0, 1
	case 'D':
		return 0, -1
	case 'L':
		return -1, 0
	case 'R':
		return 1, 0
	}
	return 0, 0
}

func isGood(have, want map[rune]int) bool {
	for k, v := range want {
		if have[k] < v {
			return false
		}
	}
	return true
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func Max(args ...int) int {
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

func Abs(x int) int {
	if (x < 0) {
		return -x
	} else {
		return x
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	X := io.NextInt()
	Y := io.NextInt()

	if N % 2 != Abs(X + Y) % 2 {
		io.Println(-1)
		return
	}

	L := 0
	R := N
	good := -1
	for L <= R {
		M := (L + R) >> 1
		if can(S, M, X, Y) {
			R = M - 1
			good = M
		} else {
			L = M + 1
		}
	}
	io.Println(good)

	// want := make(map[rune]int)
	// want['U'] = Max(0, dy - Y)
	// want['D'] = Max(0, Y - dy)
	// want['L'] = Max(0, X - dx)
	// want['R'] = Max(0, dx - X)
	// for k, v := range want {
	// 	if (v & 1) != 0 {
	// 		io.Println(-1)
	// 		return
	// 	}
	// 	want[k] >>= 1
	// }

	// A := []rune(S + "#")
	// lo := 0
	// hi := 0
	// have := make(map[rune]int)
	// best := N
	// for hi <= N {
	// 	if isGood(have, want) {
	// 		best = Min(best, hi - lo)
	// 		have[A[lo]]--
	// 		lo++
	// 	} else {
	// 		have[A[hi]]++
	// 		hi++
	// 	}
	// }
	// io.Println(best)
}

func can(S string, W, X, Y int) bool {
	N := len(S)
	x0, y0 := where(S[W:])
	A := []rune(S + "#")
	for i := W; i <= N; i++ {
		if Abs(x0 - X) + Abs(y0 - Y) <= W {
			return true
		}
		dxl, dyl := change(A[i-W])
		dxr, dyr := change(A[i])
		x0 += dxl - dxr
		y0 += dyl - dyr
	}
	return false
}

func where(S string) (int, int) {
	x := 0
	y := 0
	for _, c := range S {
		dx, dy := change(c)
		x += dx
		y += dy
	}
	return x, y
}

func change(c rune) (int, int) {
	switch c {
	case 'U':
		return 0, 1
	case 'D':
		return 0, -1
	case 'L':
		return -1, 0
	case 'R':
		return 1, 0
	}
	return 0, 0
}

func isGood(have, want map[rune]int) bool {
	for k, v := range want {
		if have[k] < v {
			return false
		}
	}
	return true
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func Max(args ...int) int {
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

func Abs(x int) int {
	if (x < 0) {
		return -x
	} else {
		return x
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

const (
	INF = 1234567890
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	X := io.NextInt()
	Y := io.NextInt()

	if N%2 != Abs(X+Y)%2 {
		io.Println(-1)
		return
	}

	x0, y0 := where(S)
	if x0 == X && y0 == Y {
		io.Println(0)
		return
	}

	L := 0
	R := 0
	A := []rune(S + "#")
	best := INF
	for R <= N {
		if Abs(x0-X)+Abs(y0-Y) <= R-L {
			best = Min(best, R-L)
			dx, dy := change(A[L])
			x0 += dx
			y0 += dy
			L++
		} else {
			dx, dy := change(A[R])
			x0 -= dx
			y0 -= dy
			R++
		}
	}
	if best == INF {
		io.Println(-1)
	} else {
		io.Println(best)
	}
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func where(S string) (int, int) {
	x := 0
	y := 0
	for _, c := range S {
		dx, dy := change(c)
		x += dx
		y += dy
	}
	return x, y
}

func change(c rune) (int, int) {
	switch c {
	case 'U':
		return 0, 1
	case 'D':
		return 0, -1
	case 'L':
		return -1, 0
	case 'R':
		return 1, 0
	}
	return 0, 0
}

func Abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	X := io.NextInt()
	Y := io.NextInt()

	if N % 2 != Abs(X + Y) % 2 {
		io.Println(-1)
		return
	}

	L := 0
	R := N
	good := -1
	for L <= R {
		M := (L + R) >> 1
		if can(S, M, X, Y) {
			R = M - 1
			good = M
		} else {
			L = M + 1
		}
	}
	io.Println(good)
}

func can(S string, W, X, Y int) bool {
	N := len(S)
	x0, y0 := where(S[W:])
	A := []rune(S + "#")
	for i := W; i <= N; i++ {
		if Abs(x0 - X) + Abs(y0 - Y) <= W {
			return true
		}
		dxl, dyl := change(A[i-W])
		dxr, dyr := change(A[i])
		x0 += dxl - dxr
		y0 += dyl - dyr
	}
	return false
}

func where(S string) (int, int) {
	x := 0
	y := 0
	for _, c := range S {
		dx, dy := change(c)
		x += dx
		y += dy
	}
	return x, y
}

func change(c rune) (int, int) {
	switch c {
	case 'U':
		return 0, 1
	case 'D':
		return 0, -1
	case 'L':
		return -1, 0
	case 'R':
		return 1, 0
	}
	return 0, 0
}

func Abs(x int) int {
	if (x < 0) {
		return -x
	} else {
		return x
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

const (
	INF = 1234567890
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	X := io.NextInt()
	Y := io.NextInt()

	if N%2 != Abs(X+Y)%2 {
		io.Println(-1)
		return
	}

	x0, y0 := where(S)
	if x0 == X && y0 == Y {
		io.Println(0)
		return
	}

	L := 0
	R := 0
	A := []rune(S + "#")
	best := INF
	for R <= N {
		if Abs(x0-X)+Abs(y0-Y) <= R-L {
			best = Min(best, R-L)
			dx, dy := change(A[L])
			x0 += dx
			y0 += dy
			L++
		} else {
			dx, dy := change(A[R])
			x0 -= dx
			y0 -= dy
			R++
		}
	}
	if best == INF {
		io.Println(-1)
	} else {
		io.Println(best)
	}
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func can(S string, W, X, Y int) bool {
	N := len(S)
	x0, y0 := where(S[W:])
	A := []rune(S + "#")
	for i := W; i <= N; i++ {
		if Abs(x0-X)+Abs(y0-Y) <= W {
			return true
		}
		dxl, dyl := change(A[i-W])
		dxr, dyr := change(A[i])
		x0 += dxl - dxr
		y0 += dyl - dyr
	}
	return false
}

func where(S string) (int, int) {
	x := 0
	y := 0
	for _, c := range S {
		dx, dy := change(c)
		x += dx
		y += dy
	}
	return x, y
}

func change(c rune) (int, int) {
	switch c {
	case 'U':
		return 0, 1
	case 'D':
		return 0, -1
	case 'L':
		return -1, 0
	case 'R':
		return 1, 0
	}
	return 0, 0
}

func Abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	X := io.NextInt()
	Y := io.NextInt()

	dx := 0
	dy := 0
	for _, c := range S {
		switch c {
		case 'U':
			dy++
		case 'D':
			dy--
		case 'L':
			dx--
		case 'R':
			dx++
		}
	}

	if dx == X && dy == Y {
		io.Println(0)
		return
	}

	want := make(map[rune]int)
	want['U'] = Max(0, dy - Y)
	want['D'] = Max(0, Y - dy)
	want['L'] = Max(0, X - dx)
	want['R'] = Max(0, dx - X)
	for k, v := range want {
		if (v & 1) != 0 {
			io.Println(-1)
			return
		}
		want[k] >>= 1
	}

	A := []rune(S + "#")
	lo := 0
	hi := 0
	have := make(map[rune]int)
	best := N
	for hi <= N {
		if isGood(have, want) {
			best = Min(best, hi - lo)
			have[A[lo]]--
			lo++
		} else {
			have[A[hi]]++
			hi++
		}
	}
	io.Println(best)
}

func isGood(have, want map[rune]int) bool {
	for k, v := range want {
		if have[k] < v {
			return false
		}
	}
	return true
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func Max(args ...int) int {
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import (
	"fmt"
	"os"
)

var dirMap = map[rune][2]int{
	'R': [2]int{1, 0},
	'L': [2]int{-1, 0},
	'U': [2]int{0, 1},
	'D': [2]int{0, -1},
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func checkValidation(length int, goal [2]int) bool {
	minLength := abs(goal[0]) + abs(goal[1])
	if minLength > length {
		return false
	}
	return (minLength % 2) == (length % 2)
}

func main() {
	n, s, x, y := 0, "", 0, 0
	fmt.Scan(&n, &s, &x, &y)
	if !checkValidation(n, [2]int{x, y}) {
		fmt.Println(-1)
		os.Exit(0)
	}
	sum := make([][2]int, n+1)
	for k, m := range s {
		dir := dirMap[m]
		sum[k+1] = [2]int{sum[k][0] + dir[0], sum[k][1] + dir[1]}
	}
	dX, dY := x-sum[n][0], y-sum[n][1]
	if dX == 0 && dY == 0 {
		fmt.Println(0)
		os.Exit(0)
	}

	l, r, length := 1, n, -1
	for l <= r {
		mid, works := (l+r)/2, false

		for i := 0; i <= (n - mid); i++ {
			sumX, sumY := sum[i+mid][0]-sum[i][0], sum[i+mid][1]-sum[i][1]
			newGoal := [2]int{sumX + dX, sumY + dY}
			if checkValidation(mid, newGoal) {
				works = true
				break
			}
		}
		if works {
			r, length = mid-1, mid
		} else {
			l = mid + 1
		}
	}
	fmt.Println(length)
}


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    seq = input()
    x, y = map(int, input().split(' '))

    if (n < abs(x) + abs(y)) or ((abs(x) + abs(y) - n) % 2 != 0):
        print(-1)
        return

    pref_sum = [[0, 0] for _ in range(n + 1)]
    for i in range(n):
        if seq[i] == 'U':
            pref_sum[i + 1] = [pref_sum[i][0], pref_sum[i][1] + 1]
        if seq[i] == 'D':
            pref_sum[i + 1] = [pref_sum[i][0], pref_sum[i][1] - 1]
        if seq[i] == 'L':
            pref_sum[i + 1] = [pref_sum[i][0] - 1, pref_sum[i][1]]
        if seq[i] == 'R':
            pref_sum[i + 1] = [pref_sum[i][0] + 1, pref_sum[i][1]]

    x_cnt, y_cnt = pref_sum[-1]

    if (x == x_cnt) and (y == y_cnt):
        print(0)
        return

    print(x_cnt, y_cnt)

    def is_sol(z):
        for i in range(n - z + 1):
            x1, y1 = pref_sum[i]
            x2, y2 = pref_sum[i + z]
            if z >= abs(x - x_cnt + x2 - x1) + abs(y - y_cnt + y2 - y1):
                return True

        return False

    lo, hi = 0, n + 1
    mid = (hi + lo) // 2

    while True:
        if is_sol(mid):
            if not is_sol(mid - 1):
                print(mid)
                return
            hi = mid
        else:
            lo = mid

        mid = (hi + lo) // 2

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    seq = input()
    x, y = map(int, input().split(' '))

    if (n < abs(x) + abs(y)) or ((abs(x) + abs(y) - n) % 2 != 0):
        print(-1)
        return

    pref_sum = [[0, 0] for _ in range(n + 1)]
    for i in range(n):
        if seq[i] == 'U':
            pref_sum[i + 1] = [pref_sum[i][0], pref_sum[i][1] + 1]
        if seq[i] == 'D':
            pref_sum[i + 1] = [pref_sum[i][0], pref_sum[i][1] - 1]
        if seq[i] == 'L':
            pref_sum[i + 1] = [pref_sum[i][0] - 1, pref_sum[i][1]]
        if seq[i] == 'R':
            pref_sum[i + 1] = [pref_sum[i][0] + 1, pref_sum[i][1]]

    x_cnt, y_cnt = pref_sum[-1]

    if (x == x_cnt) and (y == y_cnt):
        print(0)
        return

    def is_sol(z):
        for i in range(n - z + 1):
            x1, y1 = pref_sum[i]
            x2, y2 = pref_sum[i + z]

            if abs(x1 - x2) + abs(y1 - y2) >= abs(x - x_cnt + x2 - x1) + abs(y - y_cnt + y2 - y1):
                return True

        return False

    for i in range(1, n + 1):
        is_sol(i)

    lo, hi = 0, n + 1
    mid = (hi + lo) // 2

    while True:
        if is_sol(mid):
            if not is_sol(mid - 1):
                print(mid)
                return
            hi = mid
        else:
            lo = mid

        mid = (hi + lo) // 2

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    seq = input()
    x, y = map(int, input().split(' '))

    if (n < abs(x) + abs(y)) or ((abs(x) + abs(y) - n) % 2 != 0):
        print(-1)
        return

    pref_sum = [[0, 0] for _ in range(n + 1)]
    for i in range(n):
        if seq[i] == 'U':
            pref_sum[i + 1] = [pref_sum[i][0], pref_sum[i][1] + 1]
        if seq[i] == 'D':
            pref_sum[i + 1] = [pref_sum[i][0], pref_sum[i][1] - 1]
        if seq[i] == 'L':
            pref_sum[i + 1] = [pref_sum[i][0] - 1, pref_sum[i][1]]
        if seq[i] == 'R':
            pref_sum[i + 1] = [pref_sum[i][0] + 1, pref_sum[i][1]]

    x_cnt, y_cnt = pref_sum[-1]

    if (x == x_cnt) and (y == y_cnt):
        print(0)
        return

    def is_sol(z):
        for i in range(n - z + 1):
            x1, y1 = pref_sum[i]
            x2, y2 = pref_sum[i + z]
            if z >= abs(x - x_cnt + x2 - x1) + abs(y - y_cnt + y2 - y1):
                return True

        return False

    lo, hi = 0, n + 1
    mid = (hi + lo) // 2

    while True:
        if is_sol(mid):
            if not is_sol(mid - 1):
                print(mid)
                return
            hi = mid
        else:
            lo = mid

        mid = (hi + lo) // 2

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


"""
What I cannot create, I do not understand.

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
# IMPORTS---------------------------------------------------------------------#
from __future__ import division, print_function

import itertools
import sys
from atexit import register
from io import BytesIO

# import cmath
# import math
# import operator as op
# import random
# from bisect import bisect_left as bl, bisect_right as br
from collections import Counter, defaultdict, deque
# from copy import deepcopy
# from cPickle import dumps
# from decimal import Decimal, getcontext
# from difflib import SequenceMatcher
# from fractions import Fraction, gcd
# from heapq import heappop, heappush
# from Queue import PriorityQueue, Queue

# PYTHON3---------------------------------------------------------------------#
class dict(dict):
    def items(self):
        return dict.iteritems(self)

    def keys(self):
        return dict.iterkeys(self)

    def values(self):
        return dict.itervalues(self)

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

input = raw_input
range = xrange

# FASTIO----------------------------------------------------------------------#
# sys.stdout = BytesIO()
# register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
# sys.stdin = BytesIO(sys.stdin.read())

# input = lambda: sys.stdin.readline().rstrip()
# print = lambda *args: sys.stdout.write(' '.join(str(x) for x in args) + '\n')
# flush = sys.stdout.flush

# SETTINGS--------------------------------------------------------------------#
# getcontext().prec = 100
# sys.setrecursionlimit(32768)

# CONSTANTS-------------------------------------------------------------------#
MOD = 1000000007
INF = float('+inf')

ASCII_LOWERCASE = 'abcdefghijklmnopqrstuvwxyz'
ASCII_UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

# MAIN------------------------------------------------------------------------#
def main():
    n = int(input())
    ops = Counter(input())
    x, y = map(int, input().split(' '))

    if n < abs(x) + abs(y):
        print(-1)
    else:
        diff_x = x - (ops['U'] - ops['D'])
        diff_y = y - (ops['R'] - ops['L'])
        print((abs(diff_x) + abs(diff_y) + 1) // 2)

if __name__ == '__main__':
    main()