import java.util.* ;
import java.io.* ;
import java.math.* ;
class Main {
Scanner sc
= new Scanner
( System .
in ) ; //new File("input.txt")); int n = sc.nextInt ( ) ;
int a[ ] [ ] = new int [ 1005 ] [ 1005 ] ;
int ans = 0 ;
for ( int i = 0 ; i < 1000 ; i++ )
for ( int j = 0 ; j < 1000 ; j++ )
a[ i] [ j] = 0 ;
for ( int i = 0 ; i < n; i++ )
{
int x1 = sc.nextInt ( ) ;
int y1 = sc.nextInt ( ) ;
int x2 = sc.nextInt ( ) ;
int y2 = sc.nextInt ( ) ;
for ( int j = x1; j <= x2; j++ )
for ( int k = y1; k <= y2; k++ )
a[ j] [ k] ++;
}
for ( int i = 0 ; i <= 100 ; i++ )
for ( int j = 0 ; j <= 100 ; j++ )
ans += a[ i] [ j] ;
pw.println ( ans) ;
pw.close ( ) ;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2YS5tYXRoLio7CgpjbGFzcyBNYWluIHsKCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB0aHJvd3MgSU9FeGNlcHRpb257CgkJU2Nhbm5lciBzYyA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7Ly9uZXcgRmlsZSgiaW5wdXQudHh0IikpOwoJICAgIFByaW50V3JpdGVyIHB3ID0gbmV3IFByaW50V3JpdGVyKFN5c3RlbS5vdXQpOy8vbmV3IEZpbGUoIm91dHB1dC50eHQiKSk7CiAgICAgIGludCBuID0gc2MubmV4dEludCgpOwogICAgICBpbnQgYVtdW10gPSBuZXcgaW50WzEwMDVdWzEwMDVdOwogICAgICBpbnQgYW5zID0gMDsKICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDAwOyBpKyspCiAgICAJICBmb3IgKGludCBqID0gMDsgaiA8IDEwMDA7IGorKykKICAgIAkJICBhW2ldW2pdID0gMDsKICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgIHsKICAgIAkgIGludCB4MSA9IHNjLm5leHRJbnQoKTsKICAgIAkgIGludCB5MSA9IHNjLm5leHRJbnQoKTsKICAgIAkgIGludCB4MiA9IHNjLm5leHRJbnQoKTsKICAgIAkgIGludCB5MiA9IHNjLm5leHRJbnQoKTsKICAgIAkgIGZvciAoaW50IGogPSB4MTsgaiA8PSB4MjsgaisrKQogICAgCQkgIGZvciAoaW50IGsgPSB5MTsgayA8PSB5MjsgaysrKQogICAgCQkJICBhW2pdW2tdKys7CiAgICAgIH0KICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gMTAwOyBpKyspCiAgICAJICBmb3IgKGludCBqID0gMDsgaiA8PSAxMDA7IGorKykKICAgIAkJICBhbnMgKz0gYVtpXVtqXTsKICAgICAgcHcucHJpbnRsbihhbnMpOwoJICAgcHcuY2xvc2UoKTsKCX0KfQo=