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

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

        let x,y; x=y=0;

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

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

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

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

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

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

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

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

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

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

    // END FUNCTION DEFINITIONS

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

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

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

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

});

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

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

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

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

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

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

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

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

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

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

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

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

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

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

                prev = false;
            }
        }
        return minWindow;
    }

    // END FUNCTION DEFINITIONS

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

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

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

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

});

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

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

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

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

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

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

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

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

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

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

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

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

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

    // END FUNCTION DEFINITIONS

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

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

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

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

});

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

/* END NODEJS READ INPUT */

    //BEGIN FUNCTION DEFINTIONS
    function analyzeInput (input) {

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

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

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

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

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

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

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

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

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

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

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

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

                prev = false;
            }
        }
        return minWindow;
    }

    // END FUNCTION DEFINITIONS

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

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

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

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

});

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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

    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 = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

    return minWindow;

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

//console.log(result2);

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

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

})

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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})

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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

    return minWindow;

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

//console.log(result2);

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

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

})

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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

    let minWindow = {val: ''};

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

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

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

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

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

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

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

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

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

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

})

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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

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

    let minWindow = {val: ''};

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

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

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

    let prev = false;
    let begHold = 0;

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

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

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

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

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

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

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

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

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

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

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

            prev = false;
        }

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

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

})

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

    /* END NODEJS READ INPUT */

const DEBUG = false;

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

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

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

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

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

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

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

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

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

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

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

    return finalResult || -1;
}

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

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

    let minWindow = {val: ''};

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

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

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

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

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

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

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

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

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

    }

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

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

}

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

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

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

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

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

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

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

    }

    return false;
}

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

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

INPUT = lines[1];

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

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

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

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

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

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

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

})

/* 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 = 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}`);
*/

})