```
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int areaA = (C - A)*(D - B);
int areaB = (G - E)*(H - F);
int total = areaA + areaB;
//if no intersection, then just return total area
if (C <= E || A >= G || D <= F || B >= H)
return total;
//else get the coordinate of intersection at (bottom,left) (top, right)
// (max(a,e), max(f,b)) (min(c,g), min(h,d))
int interCection = (min(C, G) - max(A, E))*(min(H, D) - max(F, B));
return (total - interCection);
}
```