#include <bits/stdc++.h>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
#define rep(i,a) for (int i=0;i<a;i++)
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}

const int HIGH=30,WIDTH=30;
int start_x,start_y,end_x,end_y;
pair<int,int> DIRECTION[HIGH][WIDTH];
int DISTANCE[HIGH][WIDTH][2]={0};
int SUB_1[HIGH][WIDTH][2];
string WAY;
int ANSWER;
void solve();
void bulid();
void adjust();
void dijkstr(bool typ);
int diff_x[4]={0,1,0,-1};
int diff_y[4]={-1,0,1,0};
int TEISUU=20;
int D=5;

int f(int a,int b){
	if(a>b) swap(a,b);
	if(b-a==1) return DISTANCE[a/30][a%30][0];
	else return DISTANCE[a/30][a%30][1];
}

int g(int a,int b){
	if(a>b) swap(a,b);
	if(b-a==1) return SUB_1[a/30][a%30][0];
	else return SUB_1[a/30][a%30][1];
}

tuple<int,int,int> h(int a,int b){
	if(a>b) swap(a,b);
	if(b-a==1) return {a/30,a%30,0};
	else return{a/30,a%30,1};
}

char kigou(pair<int,int> a){
	if(a==(pair<int,int>){0,1}) return 'R';
	if(a==(pair<int,int>){1,0}) return 'D';
	if(a==(pair<int,int>){0,-1}) return 'L';
	return 'U';
}

pair<int,int> dif(char a){
	if(a=='R') return {0,1};
	if(a=='L') return {0,-1};
	if(a=='U') return {-1,0};
	return {1,0};
}

//main関数だよーーー
int main() {
	solve();
}

void solve(){
	rep(i,HIGH) rep(j,WIDTH){
		SUB_1[i][j][0]=TEISUU;
		SUB_1[i][j][1]=TEISUU;
		DISTANCE[i][j][0]=5000;
		DISTANCE[i][j][1]=5000;
	}
	int first_roop=167;
	rep(i,1000){
		//cout<<"I"<<endl;
		cin>>start_x>>start_y>>end_x>>end_y;
		dijkstr(i<first_roop);
		bulid();
		cout<<WAY<<endl;
		cin>>ANSWER;
		adjust();
	}
}

void bulid(){
	WAY="";
	int look_x=end_x,look_y=end_y;
	while(look_x!=start_x||look_y!=start_y){
		WAY+=kigou(DIRECTION[look_x][look_y]);
		int a,b;
		tie(a,b)=DIRECTION[look_x][look_y];
		look_x-=a;
		look_y-=b;
	}
	reverse(WAY.begin(),WAY.end());
}

void adjust(){
	int ave=ANSWER/(int) WAY.size();
	int look=start_x*30+start_y;
	rep(i,(int)WAY.size()){
		int a,b,c;
		tie(a,b)=dif(WAY[i]);
		int now=look;
		now+=a*30+b;
		tie(a,b,c)=h(look,now);
		if(SUB_1[a][b][c]==TEISUU) DISTANCE[a][b][c]=ave;
		else{
			int E=(SUB_1[a][b][c]-TEISUU);
			DISTANCE[a][b][c]=(DISTANCE[a][b][c]*E+ave+(E/2))/(E+1);
		}
		SUB_1[a][b][c]++;
		//cout<<a<<" "<<b<<" "<<c<<'\n';
		look=now;
	}
}

void dijkstr(bool type){
	_pq<tuple<int,int>> pq;//<lenth,to>
	vector<int> seen(900,(1<<30));
	int start=start_x*30+start_y;
	seen[start]=0;
	pq.push({0,start});
	while(!pq.empty()){
		int lenth,to;
		tie(lenth,to)=pq.top();
		pq.pop();
		if(lenth<seen[to]){
			continue;
		}
		int x=to/30,y=to%30;
		rep(i,4){
			int now_x=x+diff_x[i];
			int now_y=y+diff_y[i];
			int now=now_x*30+now_y;
			if(now_x==30||now_y==30||now_x<0||now_y<0) continue;
			int new_dis=lenth;
			if(type==true) new_dis+=g(to,now);
			else new_dis+=f(to,now);
			if(chmin(seen[now],new_dis)){
				pq.push({seen[now],now});
				DIRECTION[now_x][now_y]={diff_x[i],diff_y[i]};
			}
		}
	}
}



#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define pb emplace_back
#define lb(v,k) (lower_bound(all(v),(k))-v.begin())
#define ub(v,k) (upper_bound(all(v),(k))-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define all(a) a.begin(),a.end()
#define rsort(a) {sort(all(a));reverse(all(a));}
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void outset(T s){auto itr=s.begin();while(itr!=s.end()){if(itr!=s.begin())cout<<' ';cout<<*itr;itr++;}cout<<'\n';}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
bool is_prime(ll n){
    if(n<=1)return false;
    REP(i,2,sqrt(n)+1)if(n%i==0)return false;
    return true;
}
int main(){
    ll a,b;cin>>a>>b;
    vi s;
    REP(i,2,72)if(is_prime(i))s.pb(i);
    vvi t(20);
    ll r=1;
    REP(i,a,b+1){
        bool c=false;
        rep(j,20)if(i%s[j]==0){
            c=true;t[j].pb(i);break;
        }
        if(!c)r*=2;
    }
    vb used(20,false);
    ll ans=0;
    function<void(ll)> dfs=[&](ll c){
        if(c==20){
            ans++;return;
        }
        dfs(c+1);
        if(used[c])return;
        for(ll x:t[c]){
            bool ok=true;
            rep(i,20)if(used[i]&&x%s[i]==0)ok=false;
            if(ok){
                rep(i,20)if(x%s[i]==0)used[i]=true;
                dfs(c+1);
                rep(i,20)if(x%s[i]==0)used[i]=false;
            }
        }
    };
    dfs(0);
    ans*=r;
    out(ans);
}