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

#define SOLVER(x) solve_B x

static void s_solve(void)
{
    long long N, X;
    string S;
    long long ans;

    cin >> N >> X;
    cin >> S;

    ans = X;
    for (long long i = 0; i < N; i++)
    {
        switch ( S.at(i) )
        {
            case 'o':
                ans += 1;
                break;
            case 'x':
                if ( ans > 0 )
                {
                    ans -= 1;
                }
                break;
        }
    }

    cout << ans << endl;

    return;
}

void SOLVER((volatile bool *do_loop))
{
    do {
        s_solve();
    } while ((do_loop != NULL) && (*do_loop));
}

#ifndef NO_PROBLEM_MAIN
int main( void )
{
    SOLVER((NULL));
    return 0;
}
#endif

#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>

#define BUF_SIZE 500

enum way {
    u,
    l,
    r,
    d
};

int main()
{
    short int si, sj;
    {
        char buf[1000];
        std::stringstream ss;
        std::cin.getline(buf, 1000);
        ss << buf;
        ss >> si >> sj;
    }

    short int t[52][52] = {0};
    for (short int j=0;j<52;j++)
        t[0][j] = -1;
    for (short int i=1;i<51;i++) {
        t[i][0] = -1;
        char buf[BUF_SIZE];
        std::stringstream ss;
        std::cin.getline(buf, BUF_SIZE);
        ss << buf;
        for (short int j=1;j<51;j++) {
            ss >> t[i][j];
        }
        t[i][51] = -1;
    }
    for (short int j=0;j<52;j++)
        t[51][j] = -1;
    short int p[52][52] = {0};
    for (short int i=1;i<51;i++) {
        char buf[1000];
        std::stringstream ss;
        std::cin.getline(buf, 1000);
        ss << buf;
        for (short int j=1;j<51;j++) {
            ss >> p[i][j];
        }
    }
    std::vector<short int>tiles;
    tiles.push_back(-1);
    tiles.push_back(0);
    tiles.push_back(t[si+1][sj+1]);
    short int val_t[4];
    short int val_p[4];
    std::string output = "";
    char ways[5] = "ULRD";
    short int diff_i[4] = { -1, 0, 0, +1 };
    short int diff_j[4] = { 0, -1, +1, 0 };
    while (true) {
        val_t[u] = t[si+1-1][sj+1];   //u
        val_t[l] = t[si+1]  [sj+1-1]; //l
        val_t[r] = t[si+1]  [sj+1+1]; //r
        val_t[d] = t[si+1+1][sj+1];   //d
        val_p[u] = p[si+1-1][sj+1];   //u
        val_p[l] = p[si+1]  [sj+1-1]; //l
        val_p[r] = p[si+1]  [sj+1+1]; //r
        val_p[d] = p[si+1+1][sj+1];   //d
        short int max_t = 0;
        short int max_p = -1;
        short int max_way = -1;
        for (int i=0;i<4;i++) {
            if (std::find(tiles.begin(), tiles.end(), val_t[i]) == tiles.end()) {
                if (max_p < val_p[i]) {
                    max_p = val_p[i];
                    max_t = val_t[i];
                    max_way = i;
                }
            }
        }
        if (max_way==-1)
            break;
        output += ways[max_way];
        tiles.push_back(max_t);
        si += diff_i[max_way];
        sj += diff_j[max_way];
    }
    std::cout << output << std::endl;
    return 0;
}