#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long ll; typedef pair P; template struct LazySegmentTree{ using F=function; using G=function; using H=function; int sz; vector data; vector lazy; const F f; const G g; const H h; const Monoid e1; const OperatorMonoid e0; LazySegmentTree(int n, const F f, const G g, const H h, const Monoid &e1, const OperatorMonoid &e0): f(f), g(g), h(h), e1(e1), e0(e0){ sz=1; while(sz v){ for(int i=0; i=0; i--) data[i]=f(data[2*i+1], data[2*i+2]); } void eval(int k, int l, int r){ if(lazy[k]!=e0){ data[k]=g(data[k], lazy[k], r-l); if(k>n; vector a(n); for(int i=0; i>a[i]; auto f=[&](ll a, ll b){ return min(a, b);}; auto g=[&](ll a, ll x, int len){ return a+x; }; auto h=[&](ll x, ll y){ return x+y; }; const ll INF=1e18; LazySegmentTree seg(n, f, g, h, INF, 0); seg.build(a); int q; cin>>q; while(q--){ int k, l, r; ll c; cin>>k>>l>>r>>c; l--; if(k==1) seg.update(l, r, c); else cout<