#include <bits/stdc++.h>
#define PI acos(-1)
#define all(a) (a).begin(), (a).end()
#define erjinzhi(n) __builtin_popcountll(n);
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//#pragma GCC optimize(2,"Ofast","inline")
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
const char nl = '\n';
const int N = 2e5+10;
LL get_sum(LL x1,LL y1,LL x2,LL y2){
return (x2-x1)*(y2-y1);
}
int main()
{
LL x1,y1,x2,y2,x3,y3,x4,y4;
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
LL sum1=get_sum(x1,y1,x2,y2)+get_sum(x3,y3,x4,y4);
LL sum2 = 0;
LL x_1,y_1,x_2,y_2;
if(x3<x2&&x4>x1&&y3<y2&&y4>y1){//判断是否有重合部分
x_1 = max(x1,x3);
y_1 = max(y1,y3);
x_2 = min(x2,x4);
y_2 = min(y2,y4);
sum2=get_sum(x_1,y_1,x_2,y_2);
//cout<<x_1<<" "<<y_1<<" "<<x_2<<" "<<y_2<<nl;
}
cout<<sum1-sum2;
return 0;
}