# include using namespace std; const long long maxn = 8e5+5; long long a[maxn]; struct Segment { long long tek[maxn],fromlazy[maxn],inv[maxn]; bool lazy[maxn]; void init(long long v, long long from, long long to) { fromlazy[v] = 0; inv[v] = 1; lazy[v] = 0; if(from==to) { tek[v] = a[from]; return; } long long mid = (from+to)/2; init(2*v,from,mid); init(2*v+1,mid+1,to); tek[v] = tek[2*v]+tek[2*v+1]; } void update_lazy(long long v, long long from, long long to) { if(!lazy[v])return ; // cout<<"update_lazy : "<mid)update(2*v+1,mid+1,to,l,r,x); tek[v] = tek[2*v]+tek[2*v+1]; } long long query(long long v,long long from, long long to, long long l, long long r) { update_lazy(v,from,to); // cout<mid)ans+=query(2*v+1,mid+1,to,l,r); return ans; } }; Segment S; int L[maxn]; void upd(int from, int to, int k) { int i; for(i=from;i<=to;i++) L[i] = k-L[i]; } int qu(int from, int to) { int i,sum=0; for(i=from;i<=to;i++) sum+=L[i]; return sum; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); freopen("accounting.in","r",stdin); freopen("accounting.out","w",stdout); long long n,q; cin>>n>>q; long long i,j,u,v,t; char ch; for(i = 1;i<=n;i++){cin>>a[i];L[i]=a[i];} S.init(1,1,n); for(i=1;i<=q;i++) { cin>>ch>>u>>v; if(ch=='-') { cin>>t; S.update(1,1,n,u,v,t); // upd(u,v,t); } else { cout<