#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } template struct RectangleUnion{ private: map mp; public: T S; RectangleUnion():S(0){ const T inf=numeric_limits::max()/2; mp[0]=inf; mp[inf]=0; } void add(T x,T y){ auto ite=mp.lower_bound(x); if(ite->second>=y) return ; T lw=ite->second; T h=y-lw; ite=prev(ite); while(ite->second<=y){ S-=(x-ite->first)*(ite->second-lw); lw=ite->second; ite=prev(mp.erase(ite)); } S+=h*(x-ite->first); mp[x]=y; } }; signed main(){ int n;cin>>n; RectangleUnion ur,ul,dr,dl; ll pre=0; while(n--){ ll xp,yp,xm,ym;cin>>xm>>ym>>xp>>yp; ur.add(xp,yp); ul.add(-xm,yp); dr.add(xp,-ym); dl.add(-xm,-ym); ll sum=ur.S+ul.S+dr.S+dl.S; cout<