```
class Solution {
public:
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int edge1 = C - A, edge2 = D - B, edge3 = G - E, edge4 = H - F;
if (C<=E || A>=G || B>=H || D<=F ) return edge1 * edge2 + edge3 * edge4;
int lower_x = max(A,E), lower_y = max(B,F), upper_x = min(C,G), upper_y = min(D,H);
return edge1 * edge2 + edge3 * edge4- (upper_x - lower_x) * (upper_y - lower_y);
}
};
```