#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i,n) for(ll i=0;i T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); } template T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); } template inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; } template ostream &operator<<(ostream &os, const vector &a){ if (a.empty()) return os; os << a.front(); for (auto e : a | views::drop(1)){ os << ' ' << e; } return os; } void dump(auto ...vs){ ((cout << vs << ' '), ...) << endl; } #include using namespace atcoder; using mint = modint998244353; // range add range min namespace range_add_range_min{ using typeS = long long; using typeF = long long; const typeS INF = 8e18; typeS op(typeS a, typeS b){ return std::min(a, b); } typeS e(){ return INF; } typeS mapping(typeF f, typeS x){ return f+x; } typeF composition(typeF f, typeF g){ return f+g; } typeF id(){ return 0; } using lst_range_add_range_min=lazy_segtree; } using namespace range_add_range_min; void solve() { ll Q,L; cin>>Q>>L; auto op=[](ll x,ll y)->ll { return min(x,y); }; auto e=[]()->ll { return 1e18; }; lst_range_add_range_min lst(vector (L,0)); rep(_,Q){ ll t,l,r,c; cin>>t>>l>>r>>c; if (t==1){ lst.apply(l,r,c); } else{ lst.apply(l,r,-c); } ll ans=lst.all_prod(); cout<sync_with_stdio(0); ll T=1; while (T--){ solve(); } return 0; }