you n rectangle ith rectangle height h_i width w_iyou ask q query form h_s w_s h_b w_b for query output total area rectangle fit rectangle height h_s width w_s fitting rectangle height h_b width w_b in word print sum h_i cdot w_i h_s h_i h_b w_s w_i w_b please note rectangle height width fit inside also note rotate rectanglesplease note answer test case will not fit 32bit integer type use 64bit integer type programming language like long long c