// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>; using PD = pair<double,ll>;
using TP = tuple<double,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll n = 30;
double dist[n][n][4];
double cnt[n][n][4];
ll dx[] = {1,0,-1,0};
ll dy[] = {0,1,0,-1};
vector<ll> dijcstra(ll sx,ll sy,ll gx,ll gy, ll ADDR) {
  const ll INF = 1e15;
  vector<vector<double>> d(n,vector<double>(n, INF));
  vector<vector<P>> pr(n,vector<P>(n, P(-1,-1)));
  priority_queue<TP,vector<TP>,greater<TP>> que;
  d[sx][sy] = 0;
  que.push(TP(0,sx,sy));
  while(!que.empty()){
    auto [di, x, y] = que.top(); que.pop();
    if(di > d[x][y]) continue;
    for(int i=0;i<4;i++){
      ll nx = x + dx[i];
      ll ny = y + dy[i];
      if(nx<0||ny<0||nx>=n||ny>=n) continue;
      if(d[x][y]+dist[x][y][i]+ADDR<d[nx][ny]) {
        d[nx][ny] = d[x][y] + dist[x][y][i] + ADDR;
        pr[nx][ny] = P(x,y);
        que.push(TP(d[nx][ny],nx, ny));
      }
    }
  }
  vector<ll> res;
  while(true){
    auto [prx, pry] = pr[gx][gy];
    if(prx==-1) {
      break;
    }
    ll x = gx-prx;
    ll y = gy-pry;
    if(x==1&&y==0) res.push_back(0);
    if(x==0&&y==1) res.push_back(1);
    if(x==-1&&y==0) res.push_back(2);
    if(x==0&&y==-1) res.push_back(3);
    gx = prx;
    gy = pry;
  }
  reverse(res.begin(),res.end());
  return res;
}
signed main(){
  double alpha = 0.7;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<4;k++){
        dist[i][j][k] = 5000;
        cnt[i][j][k] = 1;
      }
    }
  }
  for(int t=0;t<1000;t++){
    ll sx,sy,gx,gy;
    cin >> sx >> sy >> gx >> gy;
    ll addr = max(0, 10000 - t*10);
    auto route = dijcstra(sx,sy,gx,gy, addr);
    for(auto i: route) {
      if(i==0) cout << 'D';
      if(i==1) cout << 'R';
      if(i==2) cout << 'U';
      if(i==3) cout << 'L';
    }
    cout << endl;
    double result;
    cin >> result;
    result /= route.size();
    ll x = sx, y = sy;
    for(auto i:route){
      ll nx = x + dx[i];
      ll ny = y + dy[i];
      ll j = (i+2)%4;
      dist[x][y][i] = dist[x][y][i] + ((1/cnt[x][y][i]) * (result - dist[x][y][i]));
      dist[nx][ny][j] = dist[nx][ny][j] + ((1/cnt[nx][ny][j]) * (result - dist[nx][ny][j]));
      cnt[x][y][i]++;
      cnt[nx][ny][j]++;
      x = nx;
      y = ny;
    }
  }
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(a) -- no. of elements strictly less than a
// s.find_by_order(i) -- itertor to ith element (0 indexed)
ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef NOOBxCODER
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else 
    #define NOOBxCODER 0
    #endif
    //cin>>t;
    t=1;
    while(t--){
        cin>>k;
        cin>>n>>m;
        ll a[k];
        fo(i,k)cin>>a[i];
        ll sum=0;
        pll p[k];
        fo(i,k){
            p[i]= mp((m*a[i])%n , i);
            sum+= (m*a[i])%n;
        }
        //cout<<sum<<endl;
        sort(p,p+k);
        ll val = sum/n;
        //cout<<val;
        ll ans[k];
        fo(i, k){
            ll  j = p[i].se;
            //cout<<j<<endl;
            //cout<<a[j]<<endl;
            if(i<k-val)ans[j]= m*a[j]/n;
            else ans[j] =m*a[j]/n   + 1;
        }
        fo(i,k)cout<<ans[i]<<" ";






        
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}
