#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define fi first #define se second #define rep(i,n) for(ll i=0;i<(n);i++) #define rrep(i,n) for(ll i=(n)-1;i>=0;i--) #define orep(i,n) for(ll i=1;i<=(n);i++) #define nfor(i,s,n) for(ll i=(s);i<(n);i++) #define dfor(i,s,n) for(ll i=(s)-1;i>=n;i--) #define INF 9e18//9223372036854775807 #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define chmax(x,y) x = max(x,y) #define chmin(x,y) x = min(x,y) #define pb push_back #define pob pop_back #define vc vector #define YES cout << "Yes" << endl; #define NO cout << "No" << endl; #define YN {cout << "Yes" << endl;}else{cout << "No" << endl;} #define dame cout << -1 << endl; #define vc_unique(v) v.erase(unique(v.begin(), v.end()), v.end()) #define vc_remove(v,x) v.erase(remove(v.begin(), v.end(),x), v.end()) #define vc_rotate(v) rotate(v.begin(), v.begin()+1, v.end()) #define pop_cnt(s) ll(popcount(uint64_t(s))) #define next_p(v) next_permutation(v.begin(),v.end()) #ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif using namespace std; using ll = long long; using ld = long double; using pll = pair; using vvvvvl = vector > > > >; using vvvvl = vector > > >; using vvvl = vector > >; using vvl = vector >; using vl = vector; using Graph = vector >; template using pq = priority_queue,less >; template using pq_g = priority_queue,greater >; ll dx[4] = {0,1,0,-1};//vl dx = {1,1,0,-1,-1,-1,0,1}; ll dy[4] = {1,0,-1,0};//vl dy = {0,1,1,1,0,-1,-1,-1}; bool out_grid(ll i, ll j, ll h, ll w){//trueならcontinueする return(!(0 <= i && i < h && 0 <= j && j 0){ if((1ll << cnt) & y){ y ^= (1ll << cnt); ans *= a; ans %= MOD; } a = a*a; a %= MOD; cnt++; } return ans; } ll npow(ll x,ll y){ ll a = x; ll cnt = 0; ll ans = 1; while(y > 0){ if((1ll << cnt) & y){ y ^= (1ll << cnt); ans *= a; } a = a*a; cnt++; } return ans; } void print(ld x){printf("%.20Lf\n", x);} ////////////////////////////////////////////////////////////////// int main(){ ll N,K,T; cin >> N >> K >> T; vc a(N); vl b(N); vl katamuki(N); rep(i,N)cin >> a[i]; rep(i,N)cin >> b[i]; rep(i,N){ if(a[i] == 'A'){ katamuki[i] = -1; }else{ katamuki[i] = 1; } } vc kataban(N); rep(i,N){ kataban[i] = {b[i],i}; } sort(all(kataban)); vl ans(N); rep(i,N){ ll t; if(katamuki[i] == -1){ t = b[i]; if(t >= T){ ans[i] = b[i] - T; continue; } }else{ t = K - b[i]; if(t >= T){ ans[i] = b[i] + T; continue; } } ll x = (T - t) / K; ll y = (T - t) % K; if(x % 2 == 0){ katamuki[i] *= -1; } if(katamuki[i] == 1){ ans[i] = y; }else{ ans[i] = K - y; } } sort(all(ans)); vl sum(N); rep(i,N){ sum[kataban[i].se] = ans[i]; } rep(i,N){ cout << sum[i] << " "; } cout << endl; }