#define max(a, b) (a > b ? a : b)

#define min(a, b) (a > b ? b : a)

int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {

```
int r = (C - A) * (D - B) + (G - E) * (H - F);
if (!(A >= G || C <= E || B >= H || D <= F))
r -= (min(C, G) - max(A, E)) * (min(D, H) - max(B, F));
return r;
```

}