#include
using namespace std;
#define ll long long
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
const int M = 2e5 + 10;
ll lazy[M<<2],sum[M<<2];
void pushup(int rt){
sum[rt] = sum[rt<<1] + sum[rt<<1|1];
}
void pushdown(int rt,int m){
if(lazy[rt]){
lazy[rt<<1] += lazy[rt];
lazy[rt<<1|1] += lazy[rt];
sum[rt<<1] += lazy[rt]*(m-(m>>1));
sum[rt<<1|1] += lazy[rt]*(m>>1);
lazy[rt] = 0;
}
}
void build(int l,int r,int rt){
lazy[rt] = 0;
if(l == r){
cin>>sum[rt];
return ;
}
int m = (l + r) >> 1;
build(lson);
build(rson);
pushup(rt);
}
void update(int L,int R,int c,int l,int r,int rt){
if(L <= l&&R >= r){
lazy[rt] += c;
sum[rt] += (r - l + 1)*c;
return ;
}
pushdown(rt,r - l + 1);
int m = (l + r) >> 1;
if(L <= m) update(L,R,c,lson);
if(R > m) update(L,R,c,rson);
pushup(rt);
}
ll query(int L,int R,int l,int r,int rt){
if(L <= l&&R >= r){
return sum[rt];
}
pushdown(rt,r - l + 1);
int m = (l + r) >> 1;
ll ret = 0;
if(L <= m) ret += query(L,R,lson);
if(R > m) ret += query(L,R,rson);
return ret;
}
int main()
{
int n,q,x,l,r,c;
cin>>n;
build(1,n,1);
cin>>q;
while(q--){
cin>>x;
if(x == 1){
cin>>l>>r>>c;
update(l,r,c,1,n,1);
}
else{
cin>>l>>r;
cout<1,n,1)<<endl;
}
}
return 0;
}