#include <bits/stdc++.h>
using namespace std;
const long long INF = 10000000000000007;
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

template<class T> bool chmax(T &a, T b) {
    if (a < b) {
      a = b;
      return true;
    }
    return false;
}

vector<int> table(2500);
vector<vector<int>> tile(2500);
vector<vector<bool>> seen(50,vector<bool>(50,0));
vector<vector<int>>point(50,vector<int>(50));

int now_x, now_y;
int si, sj;
// ll sum = 0;
vector<int> dx = {1, 0, -1, 0};
vector<int> dy = {0, 1, 0, -1};
vector<int>ans;

void solve(int now_x, int now_y) {
  int cnt = 0;
  while (1) {
    cnt++;
    if (cnt%20==0) {
      si = rand()%50;
      sj = rand()%50;
    }
    int num = table[now_x+now_y*50];
    for (int j = 0; j < tile[num].size(); j++) {
      int k = tile[num][j];
      seen[k/50][k%50] = 1;
    }


    int nx,ny,index=-1;
    ll ma = -1;
    for (int i = 0; i < 4; i++) {
      nx = now_x + dx[i];
      ny = now_y + dy[i];
      if (nx<0||nx>=50||ny<0||ny>=50) continue;
      if (seen[ny][nx]==1) continue;
      ll score = 0;
      if (i==0) score += 50-si;
      else if (i==1) score += 50-sj;
      else if (i==2) score += si;
      else if (i==3) score += sj;
      score += point[ny][nx] / 10;
      if (chmax(ma, score)) {
        index = i;
      }
    }
    if (index==-1) break;
    now_x = now_x + dx[index];
    now_y = now_y + dy[index];
    ans.push_back(index);
  }
  return;
}

int main()
{
  cin >> sj >> si;
  now_x = si;
  now_y = sj;

  for (int i = 0; i < 2500; i++) {
    int num;
    cin >> num;
    table[i] = num;
    tile[num].push_back(i);
  }
  for (int i = 0; i < 2500; i++) {
    int x = i%50;
    int y = i/50;
    cin >> point[y][x];
  }

  solve(now_x, now_y);
  
  // 出力
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i]==0) cout << 'R';
    else if (ans[i]==1) cout << 'D';
    else if (ans[i]==2) cout << 'L';
    else if (ans[i]==3) cout << 'U';
  }
  cout << endl;
}




#include <bits/stdc++.h>

const long long INF = 1e9;
const long long MOD = 1e9 + 7;
//const long long MOD = 998244353;
const long long LINF = 1e18;
using namespace std;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define COUT(x) cout<<(x)<<endl
#define SCOUT(x) cout<<(x)<<" "
#define VECCOUT(x) for(auto&youso_: (x) )cout<<right<<setw(10)<<youso_<<" ";cout<<endl
#define ENDL cout<<endl
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) long long __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define mp make_pair
#define PQ priority_queue<long long>
#define PQG priority_queue<long long,V,greater<long long>>


typedef long long ll;
typedef vector<long long> vl;
typedef vector<long long> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef pair<long long, long long> pll;


#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
template<class T>
void mod(T &x) {
    x %= MOD;
    x += MOD;
    x %= MOD;
}

ll GCD(ll a, ll b) {
    if(b == 0) return a;
    else return GCD(b, a%b);
}

struct COMB{
    vl fact, fact_inv, inv;
    void init_nCk(long long SIZE) {
        fact.resize(SIZE + 5);
        fact_inv.resize(SIZE + 5);
        inv.resize(SIZE + 5);
        fact.at(0) = fact.at(1) = fact_inv.at(0) = fact_inv.at(1) = inv.at(1) = 1;
        for(long long i = 2; i < SIZE + 5; i++) {
            fact.at(i) = fact.at(i - 1)*i%MOD;
            inv.at(i) = MOD - inv.at(MOD%i)*(MOD/i)%MOD;
            fact_inv.at(i) = fact_inv.at(i - 1)*inv.at(i)%MOD;
        }
    }
    long long nCk (long long n, long long k) {
        assert(!(n < k));
        assert(!(n < 0 || k < 0));
        return fact.at(n)*(fact_inv.at(k)*fact_inv.at(n - k)%MOD)%MOD;
    }
};
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}


void Main() {
    ll ans = 0;
    LCIN(N, M, K);
    COMB c;
    c.init_nCk(3000000);
    ans = c.nCk(N + M, M);
    if(N > M + K) {
        cout << 0 << endl;
        return;
    }
    if(M + N >= M + K + 1) ans -= c.nCk(M + N,  M + K + 1);
    cout << (ans%MOD + MOD)%MOD << endl;
    return;
    
    if(N == 0) {
        cout << 1 << endl;
        return;
    }
    if(M == 0) {
        return;
    }
    for(ll i = 0; i <= N + M; i++) {
        if(K <= i && i < 2*N - K) {
            if((i - K)%2 == 0) {
                ll n = (i + K)/2;
                ll m = (i - K)/2;
                ans -= c.nCk(N + M - n - m - 1, N - n - 1);
                ans %= MOD;
            }
        }
        /* 
        if(i > K) {
            ans -= c.nCk(N + M - i - 1, M - 1);
            ans %= MOD;
        } */
    }
    cout << (ans%MOD + MOD)%MOD << endl;
}

int main() {
    cout << fixed << setprecision(15);
    Main();
    return 0;
}