#include <iostream>
/*使用数组pos[i]存储第i个球的初始位置;使用数组step[i]存储第i个球现在的运动方向,
step[i]=1表示向右走,step[i]=-1表示往左走,用加法运算就可以实现小球的移动。
模拟过程是按照时间序列,先计算小球的下一个位置,如果该位置为两端则改变运动方向。
再根据小球的新位置看看有没有2个小球碰头,有的话分别改变运动方向。
只是简单地判断2个小球是否碰头需要用暴力法算一下。*/
using namespace std;
int main(int argc, char** argv) {
int n,l,t;
cin>>n>>l>>t;
int pos[n+1],step[n+1];
for(int i=0;i<n;i++)
{
cin>>pos[i];
// 开始往右走,到达两端则回头
step[i]=1;
if(pos[i]==l||pos[i]==0)
{
step[i]=-step[i];
}
}
for(int i=0;i<t;i++)
{
// 走一步
for(int j=0;j<n;j++)
{
pos[j]+=step[j];
// 到达两端则回头
if(pos[j]==l||pos[j]==0)
{
step[j]=-step[j];
}
}
// 判断是否碰头,碰头则掉头(要避免重复比较)
for(int j=0;j<n;j++)
{
for(int k=j+1;k<n;k++)
{
if(pos[k]==pos[j])
{
step[k]=-step[k];
step[j]=-step[j];
}
}
}
}
for(int i=0;i<n;i++)
{
if(!i)
cout<<pos[i];
else
cout<<" "<<pos[i];
}
cout<<endl;
return 0;
}