C++#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 5;
int n, l, m, e;
int a[N], b[N], hp[N], sum[N], wz[N];
signed main()
{
cin >> n >> l >> m >> e;
for(int i = 1; i <= n; i ++)
hp[i] = e;
for(int i = 0; i < l; i ++)
cin >> a[i];
for(int i = 1; i <= m; i ++)
cin >> b[i];
int cur = 1, cnt = 0, f = 0;
while(cnt < m)
{
if(f == n)
break;
cnt ++;
wz[cur] = (wz[cur] + b[cnt]) % l;
// cout << wz[cur] << "\n";
if(a[wz[cur]] == 0)
continue;
if(a[wz[cur]] < 0)
{
hp[cur] += a[wz[cur]];
if(hp[cur] <= 0)
f ++;
while(1)
{
cur ++;
if(cur > n)
cur = 1;
if(hp[cur] > 0)
break;
}
}
else
{
sum[cur] += a[wz[cur]];
while(1)
{
cur ++;
if(cur > n)
cur = 1;
if(hp[cur] > 0)
break;
}
}
}
for(int i = 1; i <= n; i ++)
cout << sum[i] << " ";
return 0;
}
/*
2 6 4 1
5 3 8 4 0 1
3 4 2 4
*/