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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})


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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

        // If we can get COVERAGE to GOAL
        if ( (end-beg)>=diff && (end-beg == 1 || diff != 1) && (end-beg)%diff%2 == 0 ) {

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

            if (!minWindow.size || minWindow.size > end-beg) {
                minWindow.size = end-beg;
                minWindow.val = input.substring(beg,end-beg);

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})


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

    /* END NODEJS READ INPUT */

const DEBUG = true;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})


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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})


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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

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

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

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

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

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

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

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

})


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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})


using System;
using System.Linq;
using CompLib.Util;
using System.Threading;

public class Program
{
    private int N;
    private string S;
    private int X, Y;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        S = sc.Next();
        X = sc.NextInt();
        Y = sc.NextInt();

        {
            // 0
            int xx = S.Count(c => c == 'R') - S.Count(c => c == 'L');
            int yy = S.Count(c => c == 'U') - S.Count(c => c == 'D');
            if (xx == X && yy == Y)
            {
                Console.WriteLine("0");
                return;
            }
        }

        int ok = N + 1;
        int ng = 0;
        while (ok - ng > 1)
        {
            int mid = (ok + ng) / 2;
            if (F(mid)) ok = mid;
            else ng = mid;
        }

        if (ok > N) Console.WriteLine("-1");
        else Console.WriteLine(ok);
    }

    bool F(int len)
    {
        int xx = 0;
        int yy = 0;
        for (int i = len; i < N; i++)
        {
            switch (S[i])
            {
                case 'U':
                    yy++;
                    break;
                case 'D':
                    yy--;
                    break;
                case 'R':
                    xx++;
                    break;
                case 'L':
                    xx--;
                    break;
            }
        }

        for (int i = len; i <= N; i++)
        {
            // [i-len, i) 変える
            // それ以外変えない

            int diff = Math.Abs(Y - yy) + Math.Abs(X - xx);
            if (diff <= len && diff % 2 == len % 2) return true;

            if (i < N)
            {
                switch (S[i-len])
                {
                    case 'U':
                        yy++;
                        break;
                    case 'D':
                        yy--;
                        break;
                    case 'R':
                        xx++;
                        break;
                    case 'L':
                        xx--;
                        break;
                }

                switch (S[i])
                {
                    case 'U':
                        yy--;
                        break;
                    case 'D':
                        yy++;
                        break;
                    case 'R':
                        xx--;
                        break;
                    case 'L':
                        xx++;
                        break;
                }
            }
        }

        return false;
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

class Program
{
	static void Main()
	{
		int n = 1 + int.Parse(Console.ReadLine());
		string s = " " + Console.ReadLine();
		string[] data = Console.ReadLine().Split();
		int x = int.Parse(data[0]), y = int.Parse(data[1]);
		if (Math.Abs(x) + Math.Abs(y) > n - 1 || (Math.Abs(x) + Math.Abs(y)) % 2 != (n - 1) % 2)
		{
			Console.WriteLine(-1);
			return;
		}
		int[] R = new int[n], U = new int[n], L = new int[n], D = new int[n];
		for (int i = 1; i < s.Length; i++)
		{
			R[i] = s[i] == 'R' ? R[i - 1] + 1 : R[i - 1];
			U[i] = s[i] == 'U' ? U[i - 1] + 1 : U[i - 1];
			L[i] = s[i] == 'L' ? L[i - 1] + 1 : L[i - 1];
			D[i] = s[i] == 'D' ? D[i - 1] + 1 : D[i - 1];
		}
		int realX = 0, realY = 0;
		for (int i = 1; i < s.Length; i++)
		{
			realX += s[i] == 'R' ? 1 : 0;
			realY += s[i] == 'U' ? 1 : 0;
			realX += s[i] == 'L' ? -1 : 0;
			realY += s[i] == 'D' ? -1 : 0;
		}
		int l = -1, r = n;
		while (r - l > 1)
		{
			int m = (l + r) / 2;
			bool OK = false;
			for (int i = m; i < s.Length; i++)
				if (Math.Abs(x - (realX - ((R[i] - R[i - m]) - (L[i] - L[i - m])))) + Math.Abs(y - (realY - ((U[i] - U[i - m]) - (D[i] - D[i - m])))) <= m)
					OK = true;
			if (OK)
				r = m;
			else
				l = m;
		}
		Console.WriteLine(r);
		Console.ReadLine();
	}
}


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

class Program
{
	static void Main()
	{
		int n = 1 + int.Parse(Console.ReadLine());
		string s = " " + Console.ReadLine();
		string[] data = Console.ReadLine().Split();
		int x = int.Parse(data[0]), y = int.Parse(data[1]);
		if (Math.Abs(x) + Math.Abs(y) > n - 1 || (x + y) % 2 != (n - 1) % 2)
		{
			Console.WriteLine(-1);
			return;
		}
		int[] R = new int[n], U = new int[n], L = new int[n], D = new int[n];
		for (int i = 1; i < s.Length; i++)
		{
			R[i] = s[i] == 'R' ? R[i - 1] + 1 : R[i - 1];
			U[i] = s[i] == 'U' ? U[i - 1] + 1 : U[i - 1];
			L[i] = s[i] == 'L' ? L[i - 1] + 1 : L[i - 1];
			D[i] = s[i] == 'D' ? D[i - 1] + 1 : D[i - 1];
		}
		int realX = 0, realY = 0;
		for (int i = 1; i < s.Length; i++)
		{
			realX += s[i] == 'R' ? 1 : 0;
			realY += s[i] == 'U' ? 1 : 0;
			realX += s[i] == 'L' ? -1 : 0;
			realY += s[i] == 'D' ? -1 : 0;
		}
		int l = -1, r = n;
		while (r - l > 1)
		{
			int m = (l + r) / 2;
			bool OK = false;
			for (int i = m; i < s.Length; i++)
			{
				if (x <= realX && y <= realY && (R[i] - R[i - m]) * 2 >= (realX - x) && (U[i] - U[i - m]) * 2 >= (realY - y))
					OK = true;
				if (x >= realX && y <= realY && (L[i] - L[i - m]) * 2 >= (realX - x) && (U[i] - U[i - m]) * 2 >= (realY - y))
					OK = true;
				if (x >= realX && y >= realY && (L[i] - L[i - m]) * 2 >= (realX - x) && (D[i] - D[i - m]) * 2 >= (realY - y))
					OK = true;
				if (x <= realX && y >= realY && (R[i] - R[i - m]) * 2 >= (realX - x) && (D[i] - D[i - m]) * 2 >= (realY - y))
					OK = true;
			}
			if (OK)
				r = m;
			else
				l = m;
		}
		Console.WriteLine(r);
		Console.ReadLine();
	}
}


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

class Program
{
	static void Main()
	{
		int n = 1 + int.Parse(Console.ReadLine());
		string s = " " + Console.ReadLine();
		string[] data = Console.ReadLine().Split();
		int x = int.Parse(data[0]), y = int.Parse(data[1]);
		if (Math.Abs(x) + Math.Abs(y) > n - 1 || (x + y) % 2 != (n - 1) % 2)
		{
			Console.WriteLine(-1);
			return;
		}
		int[] R = new int[n], U = new int[n], L = new int[n], D = new int[n];
		for (int i = 1; i < s.Length; i++)
		{
			R[i] = s[i] == 'R' ? R[i - 1] + 1 : R[i - 1];
			U[i] = s[i] == 'U' ? U[i - 1] + 1 : U[i - 1];
			L[i] = s[i] == 'L' ? L[i - 1] + 1 : L[i - 1];
			D[i] = s[i] == 'D' ? D[i - 1] + 1 : D[i - 1];
		}
		int realX = 0, realY = 0;
		for (int i = 1; i < s.Length; i++)
		{
			realX += s[i] == 'R' ? 1 : 0;
			realY += s[i] == 'U' ? 1 : 0;
			realX += s[i] == 'L' ? -1 : 0;
			realY += s[i] == 'D' ? -1 : 0;
		}
		int l = -1, r = n;
		while (r - l > 1)
		{
			int m = (l + r) / 2;
			bool OK = false;
			for (int i = m; i < s.Length; i++)
				if (Math.Abs(x - (realX - ((R[i] - R[i - m]) - (L[i] - L[i - m])))) + Math.Abs(y - (realY - ((U[i] - U[i - m]) - (D[i] - D[i - m])))) <= m)
					OK = true;
			if (OK)
				r = m;
			else
				l = m;
		}
		Console.WriteLine(r);
		Console.ReadLine();
	}
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		long[] C = new long[N];
		long[] ct = new long[4];
		for(var i=0;i<N;i++){
			string at = str.Substring(i,1);
			if(at=="U"){
				C[i] = 1;
				ct[0] += 1;
			} else if(at=="R"){
				C[i] = 2;
				ct[1] += 1;
			} else if(at=="D"){
				C[i] = 3;
				ct[2] += 1;
			} else {
				C[i] = 4;
				ct[3] += 1;
			}
		}
		string[] str2 = Console.ReadLine().Split();
		long A = long.Parse(str2[0]);
		long B = long.Parse(str2[1]);
		long ans = -1;
		if(Math.Abs(A)+Math.Abs(B)<=N){
			if((Math.Abs(A)+Math.Abs(B))%2 == N%2){
				long x = 0;
				long y = 0;
				long t1 = N;
				long ci = N;
				ans = N;
				for(var i=0;i<N;i++){
					long x2 = x;
					long y2 = y;
					if(C[i] == 1){
						y += 1;
					} else if(C[i] == 2){
						x += 1;
					} else if(C[i] == 3){
						y -= 1;
					} else {
						x -= 1;
					}
					ci -= 1;
					if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
						t1 = i;
						x = x2;
						y = y2;
						ci += 1;
						break;
					}
				}
				if(x==A&&y==B){
				    ans = 0;
				} else {
    				long ia = N-1;
			    	while(true){
			    		while(true){
			    			//long x3 = x;
			    			//long y3 = y;
				    		if(C[ia] == 1){
				    			y += 1;
				    		} else if(C[ia] == 2){
				    			x += 1;
				    		} else if(C[ia] == 3){
				    			y -= 1;
				    		} else {
				    			x -= 1;
				    		}
				    		ci -= 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
				    			//x3 = x;
				    			//y3 = y;
				    			//ci += 1;
				    			//Console.WriteLine("1 ");
				    			ia -= 1;
				    			break;
				    		} else {
					    		ans = Math.Min(ans,ia-t1);
					    		//Console.WriteLine("1 "+ ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
					    		ia -= 1;
					    		if(ia==0){
				    				break;
					    		}
				    		}
				    	}
				    	while(true){
				    		if(t1==0){
				    			break;
				    		} else {
				    			t1 -= 1;
				    		}
				    		if(C[t1] == 1){
				    			y -= 1;
				    		} else if(C[t1] == 2){
				    			x -= 1;
					    	} else if(C[t1] == 3){
				    			y += 1;
				    		} else {
				    			x += 1;
				    		}
				    		ci += 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)<=ci){
				    			ans = Math.Min(ans,ia-t1);
				    			//Console.WriteLine("2 "+ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
				    			break;
				    		}
			    		}
				    	if(t1==0 || ia==0 || ans==0){
				    		break;
				    	}
			    	}
				}
			}
		}
		Console.WriteLine(ans);
	}
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		long[] C = new long[N];
		long[] ct = new long[4];
		for(var i=0;i<N;i++){
			string at = str.Substring(i,1);
			if(at=="U"){
				C[i] = 1;
				ct[0] += 1;
			} else if(at=="R"){
				C[i] = 2;
				ct[1] += 1;
			} else if(at=="D"){
				C[i] = 3;
				ct[2] += 1;
			} else {
				C[i] = 4;
				ct[3] += 1;
			}
		}
		string[] str2 = Console.ReadLine().Split();
		long A = long.Parse(str2[0]);
		long B = long.Parse(str2[1]);
		long ans = -1;
		if(Math.Abs(A)+Math.Abs(B)<=N){
			if((Math.Abs(A)+Math.Abs(B))%2 == N%2){
				long x = 0;
				long y = 0;
				long t1 = N;
				long ci = N;
				ans = N;
				for(var i=0;i<N;i++){
					long x2 = x;
					long y2 = y;
					if(C[i] == 1){
						y += 1;
					} else if(C[i] == 2){
						x += 1;
					} else if(C[i] == 3){
						y -= 1;
					} else {
						x -= 1;
					}
					ci -= 1;
					if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
						t1 = i;
						x = x2;
						y = y2;
						ci += 1;
						break;
					}
				}
				if(x==A&&y==B){
				    ans = 0;
				} else {
    				long ia = N-1;
    				ans = Math.Min(ans,ia-t1+1);
			    	while(true){
			    		while(true){
			    			//long x3 = x;
			    			//long y3 = y;
				    		if(C[ia] == 1){
				    			y += 1;
				    		} else if(C[ia] == 2){
				    			x += 1;
				    		} else if(C[ia] == 3){
				    			y -= 1;
				    		} else {
				    			x -= 1;
				    		}
				    		ci -= 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
				    			//x3 = x;
				    			//y3 = y;
				    			//ci += 1;
				    			//Console.WriteLine("1 "+ia);
				    			ia -= 1;
				    			if(t1==0){
				    			    t1 = -1;
				    			}
				    			break;
				    		} else {
					    		ans = Math.Min(ans,ia-t1);
					    		//Console.WriteLine("1 "+ ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
					    		ia -= 1;
					    		if(ia==0){
				    				break;
					    		}
				    		}
				    	}
				    	if(t1==-1){
				    	    break;
				    	}
				    	while(true){
				    		if(t1>0){
				    		//	break;
				    		//} else {
				    			t1 -= 1;
				    		}
				    		if(C[t1] == 1){
				    			y -= 1;
				    		} else if(C[t1] == 2){
				    			x -= 1;
					    	} else if(C[t1] == 3){
				    			y += 1;
				    		} else {
				    			x += 1;
				    		}
				    		ci += 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)<=ci){
				    			ans = Math.Min(ans,ia-t1+1);
				    			//Console.WriteLine("2 "+ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
				    			break;
				    		} else if(t1==0){
				    		    t1 = -1;
				    		    break;
				    		}
			    		}
				    	if(t1==-1 || ia==0 || ans==0){
				    		break;
				    	}
			    	}
				}
			}
		}
		Console.WriteLine(ans);
	}
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		long[] C = new long[N];
		long[] ct = new long[4];
		for(var i=0;i<N;i++){
			string at = str.Substring(i,1);
			if(at=="U"){
				C[i] = 1;
				ct[0] += 1;
			} else if(at=="R"){
				C[i] = 2;
				ct[1] += 1;
			} else if(at=="D"){
				C[i] = 3;
				ct[2] += 1;
			} else {
				C[i] = 4;
				ct[3] += 1;
			}
		}
		string[] str2 = Console.ReadLine().Split();
		long A = long.Parse(str2[0]);
		long B = long.Parse(str2[1]);
		long ans = -1;
		if(Math.Abs(A)+Math.Abs(B)<=N){
			if((Math.Abs(A)+Math.Abs(B))%2 == N%2){
				long x = 0;
				long y = 0;
				long t1 = N;
				long ci = N;
				ans = N;
				for(var i=0;i<N;i++){
					long x2 = x;
					long y2 = y;
					if(C[i] == 1){
						y += 1;
					} else if(C[i] == 2){
						x += 1;
					} else if(C[i] == 3){
						y -= 1;
					} else {
						x -= 1;
					}
					ci -= 1;
					if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
						t1 = i;
						x = x2;
						y = y2;
						ci += 1;
						break;
					}
				}
				if(x==A&&y==B){
				    ans = 0;
				} else {
    				long ia = N-1;
			    	while(true){
			    		while(true){
			    			//long x3 = x;
			    			//long y3 = y;
				    		if(C[ia] == 1){
				    			y += 1;
				    		} else if(C[ia] == 2){
				    			x += 1;
				    		} else if(C[ia] == 3){
				    			y -= 1;
				    		} else {
				    			x -= 1;
				    		}
				    		ci -= 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
				    			//x3 = x;
				    			//y3 = y;
				    			//ci += 1;
				    			//Console.WriteLine("1 "+ia);
				    			ia -= 1;
				    			break;
				    		} else {
					    		ans = Math.Min(ans,ia-t1);
					    		//Console.WriteLine("1 "+ ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
					    		ia -= 1;
					    		if(ia==0){
				    				break;
					    		}
				    		}
				    	}
				    	while(true){
				    		if(t1==0){
				    			break;
				    		} else {
				    			t1 -= 1;
				    		}
				    		if(C[t1] == 1){
				    			y -= 1;
				    		} else if(C[t1] == 2){
				    			x -= 1;
					    	} else if(C[t1] == 3){
				    			y += 1;
				    		} else {
				    			x += 1;
				    		}
				    		ci += 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)<=ci){
				    			ans = Math.Min(ans,ia-t1+1);
				    			//Console.WriteLine("2 "+ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
				    			break;
				    		}
			    		}
				    	if(t1==0 || ia==0 || ans==0){
				    		break;
				    	}
			    	}
				}
			}
		}
		Console.WriteLine(ans);
	}
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		long[] C = new long[N];
		long[] ct = new long[4];
		for(var i=0;i<N;i++){
			string at = str.Substring(i,1);
			if(at=="U"){
				C[i] = 1;
				ct[0] += 1;
			} else if(at=="R"){
				C[i] = 2;
				ct[1] += 1;
			} else if(at=="D"){
				C[i] = 3;
				ct[2] += 1;
			} else {
				C[i] = 4;
				ct[3] += 1;
			}
		}
		string[] str2 = Console.ReadLine().Split();
		long A = long.Parse(str2[0]);
		long B = long.Parse(str2[1]);
		long ans = -1;
		if(Math.Abs(A)+Math.Abs(B)<=N){
			if((Math.Abs(A)+Math.Abs(B))%2 == N%2){
				long x = 0;
				long y = 0;
				long t1 = N;
				long ci = N;
				for(var i=0;i<N;i++){
					long x2 = x;
					long y2 = y;
					if(C[i] == 1){
						y += 1;
					} else if(C[i] == 2){
						x += 1;
					} else if(C[i] == 3){
						y -= 1;
					} else {
						x -= 1;
					}
					ci -= 1;
					if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
						t1 = i;
						x = x2;
						y = y2;
						ci += 1;
						break;
					}
				}
				long t2 = t1-1;
				for(var i=N-1;i>=0;i--){
					if(C[i] == 1){
						y += 1;
					} else if(C[i] == 2){
						x += 1;
					} else if(C[i] == 3){
						y -= 1;
					} else {
						x -= 1;
					}
					ci -= 1;
					if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
						t2 = i;
						break;
					}
				}
				ans = Math.Max(t2-t1+1, 0);
			}
		}
		Console.WriteLine(ans);
	}
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		long[] C = new long[N];
		long[] ct = new long[4];
		for(var i=0;i<N;i++){
			string at = str.Substring(i,1);
			if(at=="U"){
				C[i] = 1;
				ct[0] += 1;
			} else if(at=="R"){
				C[i] = 2;
				ct[1] += 1;
			} else if(at=="D"){
				C[i] = 3;
				ct[2] += 1;
			} else {
				C[i] = 4;
				ct[3] += 1;
			}
		}
		string[] str2 = Console.ReadLine().Split();
		long A = long.Parse(str2[0]);
		long B = long.Parse(str2[1]);
		long ans = -1;
		if(Math.Abs(A)+Math.Abs(B)<=N){
			if((Math.Abs(A)+Math.Abs(B))%2 == N%2){
				long x = 0;
				long y = 0;
				long t1 = N;
				long ci = N;
				ans = N;
				for(var i=0;i<N;i++){
					long x2 = x;
					long y2 = y;
					if(C[i] == 1){
						y += 1;
					} else if(C[i] == 2){
						x += 1;
					} else if(C[i] == 3){
						y -= 1;
					} else {
						x -= 1;
					}
					ci -= 1;
					if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
						t1 = i;
						x = x2;
						y = y2;
						ci += 1;
						break;
					}
				}
				if(x==A&&y==B){
				    ans = 0;
				} else {
    				long ia = N-1;
    				ans = Math.Min(ans,ia-t1+1);
			    	while(true){
			    		while(true){
			    			//long x3 = x;
			    			//long y3 = y;
				    		if(C[ia] == 1){
				    			y += 1;
				    		} else if(C[ia] == 2){
				    			x += 1;
				    		} else if(C[ia] == 3){
				    			y -= 1;
				    		} else {
				    			x -= 1;
				    		}
				    		ci -= 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)>ci){
				    			//x3 = x;
				    			//y3 = y;
				    			//ci += 1;
				    			//Console.WriteLine("1 "+ia);
				    			ia -= 1;
				    			break;
				    		} else {
					    		ans = Math.Min(ans,ia-t1);
					    		//Console.WriteLine("1 "+ ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
					    		ia -= 1;
					    		if(ia==0){
				    				break;
					    		}
				    		}
				    	}
				    	while(true){
				    		if(t1==0){
				    			break;
				    		} else {
				    			t1 -= 1;
				    		}
				    		if(C[t1] == 1){
				    			y -= 1;
				    		} else if(C[t1] == 2){
				    			x -= 1;
					    	} else if(C[t1] == 3){
				    			y += 1;
				    		} else {
				    			x += 1;
				    		}
				    		ci += 1;
				    		if(Math.Abs(x-A)+Math.Abs(y-B)<=ci){
				    			ans = Math.Min(ans,ia-t1+1);
				    			//Console.WriteLine("2 "+ans+" "+ia+" "+t1+" "+ci+" "+x+" "+y);
				    			break;
				    		}
			    		}
				    	if(t1==0 || ia==0 || ans==0){
				    		break;
				    	}
			    	}
				}
			}
		}
		Console.WriteLine(ans);
	}
}


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();
        int 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


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-1, 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);
        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) > 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