#include int ri() { int n; scanf("%d", &n); return n; } struct Stairs { std::set > all; Stairs () { all.insert({-1000000000, 1000000000}); all.insert({1000000000, -1000000000}); } int add(int x, int y) { auto itr = all.lower_bound({x, y}); if (*itr == std::pair{x, y}) return 0; auto added = [&] (std::set >::iterator itr) { int res = itr->first * itr->second; if (std::prev(itr)->first > 0) res -= std::prev(itr)->first * itr->second; if (std::next(itr)->second > 0) res -= std::next(itr)->second * itr->first; if (std::prev(itr)->first > 0 && std::next(itr)->second > 0) res += std::prev(itr)->first * std::next(itr)->second; return res; }; int res = 0; if (itr->second >= y) return 0; while (std::prev(itr)->second <= y) res -= added(std::prev(itr)), all.erase(std::prev(itr)); return added(all.insert({x, y}).first) + res; } }; int main() { int n = ri(); Stairs all[4] = { Stairs() }; for (int i = 0; i < n; i++) { int x0 = ri(), y0 = ri(); int x1 = ri(), y1 = ri(); int res = all[0].add(x1, y1) + all[1].add(-x0, y1) + all[2].add(x1, -y0) + all[3].add(-x0, -y0); printf("%d\n", res); } return 0; }