#include #include using namespace std; using namespace atcoder; using ll=long long; int main() { int n,k,t; cin>>n>>k>>t; t%=2*k; vector right(n); for(int i=0;i>c; if(c=='B')right[i]=true; } vector> o(n); vector p(n); for(int i=0;i>b; o[i]={b,i}; if(right[i])b+=t; else b-=t; while(b>k||b<0){ if(b>k)b=2*k-b; if(b<0)b=-b; } p[i]=b; } sort(o.begin(),o.end()); sort(p.begin(),p.end()); vector ans(n); for(int i=0;i