#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e6+10;
int lb(int x){return x&-x;}
int n,q;
ll a[N];
struct tr {
ll w[4*N],lzy[4*N];
void maketag(int u,int L,int R,ll x){
w[u]+=(R-L+1)*x;
lzy[u]+=x;
}
void push_up(int u){
w[u]=w[u*2]+w[u*2+1];
}
void push_down(int u,int L,int R){
int M=(L+R)/2;
maketag(u*2,L,M,lzy[u]);
maketag(u*2+1,M+1,R,lzy[u]);
lzy[u]=0;
}
bool In(int L,int R,int l,int r){
return l<=L&&R<=r;
}
bool Out(int L,int R,int l,int r){
return R<l||r<L;
}
void build(int u,int L,int R,ll num[]){
if(L==R){
w[u]=num[L];
return;
}
int M=(L+R)/2;
build(u*2,L,M,num);
build(u*2+1,M+1,R,num);
push_up(u);
}
void update(int u,int L,int R,int l,int r,ll x){
if(In(L,R,l,r)){
maketag(u,L,R,x);
return ;
}
else if(!Out(L,R,l,r)){
int M=(L+R)/2;
push_down(u,L,R);
update(u*2,L,M,l,r,x);
update(u*2+1,M+1,R,l,r,x);
push_up(u);
}
}
ll ask(int u,int L,int R,int l,int r){
if(In(L,R,l,r)){
return w[u];
}
else if(!Out(L,R,l,r)){
int M=(L+R)/2;
push_down(u,L,R);
return ask(u*2,L,M,l,r)+ask(u*2+1,M+1,R,l,r);
}
else return 0;
}
}tree;
int get(ll HP){
int l=1,r=n,ans=0;
while(r>l){
int mid=(l+r)/2;
if(tree.ask(1,1,n,1,mid)>=HP){r=mid;ans=mid;}
else l=mid+1;
}
return ans?ans:r;
}
int main(){
ll W;
scanf("%d%d%lld",&n,&q,&W);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
}
tree.build(1,1,n,a);
for(int i=1;i<=q;i++){
int l,r;
ll d;
scanf("%d%d%lld",&l,&r,&d);
tree.update(1,1,n,l,r,d);
ll HP=W;
ll score=0;
while(HP>0){
ll pos=get(HP);
HP-=tree.ask(1,1,n,1,pos);
score+=pos;
HP/=2;
}
printf("%lld\n",score-1);
}
return 0;
}