#include using namespace std; int h,w,p; int ask(string &s){ cout << s << '\n'; fflush(stdout); int res; cin >> res; return res; } string dch="UDLR"; int dx4[4]={-1,1,0,0}; int dy4[4]={0,0,-1,1}; int cvrt[256]; int getID(int fx,int fy,int d){ if(d==0){fx--;} if(d==2){fy--;} if(d<=1){return fx*20+fy;} return (20*20)+fx*20+fy; } int fix[1024]={0}; double prob[1024]; double iniprob,hitwall; using pdi=pair; string dijkstra(){ vector d(512,1e9); vector mem(512,0); priority_queue,greater> pq; d[0]=0; mem[0]=-1; pq.push({0,0}); while(!pq.empty()){ pdi od=pq.top();pq.pop(); if(d[od.second]>od.first){continue;} int x=od.second/w; int y=od.second%w; for(int i=0;i<4;i++){ int nx=x+dx4[i]; int ny=y+dy4[i]; if(!(0<=nx && nx(od.first+cur)){ d[nv]=(od.first+cur); mem[nv]=i; pq.push({d[nv],nv}); } } } string res; int cx=h-1,cy=w-1; while(cx>0 || cy>0){ int cd=mem[cx*w+cy]; res.push_back(dch[cd]); cx-=dx4[cd]; cy-=dy4[cd]; } reverse(res.begin(),res.end()); return res; } void feedback(string &path,int hands){ int x=0,y=0; for(int i=0;i<=hands;i++){ int d=cvrt[path[i]]; int id=getID(x,y,d); if(i!=hands){fix[id]=1;} if(fix[id]){prob[id]=iniprob;} else{prob[id]+=hitwall;} x+=dx4[d]; y+=dy4[d]; } } int main(){ for(int i=0;i<4;i++){cvrt[dch[i]]=i;} cin >> h >> w >> p; iniprob=-log(((double)(100-p))/100.0); hitwall=-log(((double)p)/100.0); for(int i=0;i<1024;i++){prob[i]=iniprob;} while(1){ string cask=dijkstra(); int cres=ask(cask); if(cres==-1){break;} feedback(cask,cres); } return 0; }