#include <iostream> #include<string> #include<cmath> #include<algorithm> #include<cctype> #include<queue> #include<deque> #include<regex> #include<stack> #include<stdio.h> #include<vector> #include<set> #include<map> #include<iomanip> #define rep(i, n) for(int i=0;i<n;i++) typedef int long long ll; using namespace std; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; const ll MOD = 1e9 + 7; int m[101]; int main() { int a,b,c,d; cin>>a>>b>>c>>d; int an=b-a+1; int bn=d-c+1; for(int i=a;i<=b;i++){m[i]++;} for(int i=c;i<=d;i++){m[i]++;} int j=0; rep(i,101){ if(m[i]==2){j++;} } int ans=an*bn; ans-=j; cout<<ans<<endl; return 0; }