#include<bits/stdc++.h>
using namespace std;
#define int long long
int h[200000],n,q,w;
int pow(int k){
int d=2;
int result=1;
while(k>0){
if(k&1){
result=result*d;
}
d=d*d;
k>>=1;
}
return result;
}
signed main(){
cin>>n>>q>>w;
const int W=w;
for(int i=1;i<=n;i++){
cin>>h[i];
}
while(q--){
w=W;
int l,r,d;
cin>>l>>r>>d;
for(int i=l;i<=r;i++){
h[i]+=d;
}
int k=0;
d=1;
while(w>0){
w-=h[d]*pow(k/n);
k++;
d++;
if(d==n+1)d=1;
}
k--;
cout<<k<<endl;
}
return 0;
}