/*
TASK:area
LANG:C++
*/
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
struct P{
       double x,y;
       };
struct L{
       P p1,p2;
       double A,B,C;
       };

L ml(P &p1,P &p2)
	{
		L h;
		h.p1=p1;
		h.p2=p2;
		if(h.p1.x>h.p2.x) swap(h.p1,h.p2);
		if(h.p1.y>h.p2.y) swap(h.p1,h.p2);
		h.A=p1.y-p2.y;
		h.B=p2.x-p1.x;
		h.C=(p1.x*p2.y)-(p2.x*p1.y);
		return h;
	}
int N;
P cr(L &l1,L &l2)
	{
		P c;
		if(l1.A==l2.A&&l1.B==l2.B) {c.x=10001.0; c.y=10001.0; return c;}
		double d,d1,d2;
		d=(l1.A*l2.B)-(l2.A*l1.B);
		d1=((-l1.C)*l2.B)-((-l2.C)*l1.B);
		d2=(l1.A*(-l2.C))-(l2.A*(-l1.C));
		c.x=d1/d;
		c.y=d2/d;
		return c;
	}
bool ins(P &p1,L &l1)
	{
		
		if(p1.x>=l1.p1.x&&p1.y>=l1.p1.y&&p1.x<=l1.p2.x&&p1.y<=l1.p2.y) return 1;
		else return 0;
	}	
	
double cp(P &p1,P &p2,P &p3)
	{
		double u1,u2,w1,w2;
		u1=p1.x-p2.x;
		u2=p1.x-p3.x;
		w1=p1.y-p2.y;
		w2=p1.y-p3.y;
		return u1*w2-u2*w1;
	}		
P pp1,pp2,pp3,pp4,sp;
vector <L> l;
vector <P> s;
vector <L> f;
vector <bool> u;
L s1,s2,s3,s4;

bool cmp(P p1,P p2)
	{
		if(((sp.x-p1.x)*(sp.x-p1.x)+(sp.y-p1.y)*(sp.y-p1.y))<((sp.x-p2.x)*(sp.x-p2.x)+(sp.y-p2.y)*(sp.y-p2.y)))
			return 1;
			else return 0;
		}

int main()
{
    freopen("test.txt","r",stdin);
    freopen("test1.txt","w",stdout);
    cin>>pp1.x>>pp1.y>>pp2.x>>pp2.y>>sp.x>>sp.y;
    cin>>N;
    pp3.x=pp1.x;
    pp3.y=pp2.y;
    pp4.x=pp2.x;
    pp4.y=pp1.y;
    s.push_back(pp1);
    s.push_back(pp2);
    s.push_back(pp3);
    s.push_back(pp4);
    s1=ml(pp1,pp3);
    s2=ml(pp3,pp2);
    s3=ml(pp2,pp4);
    s4=ml(pp4,pp1);
    int i;
        for(i=1;i<=N;i++)
        	{
			P p1,p2;
			cin>>p1.x>>p1.y>>p2.x>>p2.y;
			L t;
			t=ml(p1,p2);
			l.push_back(t);
			}
		
/*		for(i=0;i<l.size();i++)
			{
				P t;
				P p1,p2;
				bool i1=0,i2=0;
				t=cr(l[i],s1);
				if(ins(t,s1))
				{		s.push_back(t);
					if(i1==0){
						i1=1;
					p1=t;}
					else if(i2==0)
						{
							i2=1;
							p2=t;}
				}
				
				t=cr(l[i],s2);
				if(ins(t,s2))
								{		s.push_back(t);
					if(i1==0){
						i1=1;
					p1=t;}
					else if(i2==0)
						{
							i2=1;
							p2=t;}
				}
				t=cr(l[i],s3);
				if(ins(t,s3))
								{		s.push_back(t);
					if(i1==0){
						i1=1;
					p1=t;}
					else if(i2==0)
						{
							i2=1;
							p2=t;}
				}
				
				t=cr(l[i],s4);
				if(ins(t,s4))
				{		s.push_back(t);
					if(i1==0){
						i1=1;
					p1=t;}
					else if(i2==0)
						{
							i2=1;
							p2=t;}
				}
				L r;
				r=ml(p1,p2);
				f.push_back(r);
				//cout<<p1.x<<" "<<p1.y<<" "<<p2.x<<" "<<p2.y<<endl;	
			}
			
		int j;
			for(i=0;i<f.size();i++)
				for(j=i+1;j<f.size();j++)
					{
						P t;
						t=cr(l[i],l[j]);
						if(ins(t,l[i])&&ins(t,l[j]))
							{
								s.push_back(t);
							}
					}		
			u.resize(s.size()+1);
			fill(u.begin(),u.end(),0);
		//	sort(s.begin(),s.end(),cmp);
	
		int k,l;
			for(i=0;i<s.size();i++)
					if(!u[i])
					for(j=0;j<s.size();j++)
								if(!u[j])
									{
									P t;
									t.x=((s[i].x+s[j].x)/2);	
									t.y=((s[i].y+s[j].y)/2);
										for(k=0;k<s.size();k++)
											if(!u[k])
												for(l=0;l<s.size();l++)
													if(!u[l])
														{
															bool u1=0,u2=0,u3=0;
															if(cp(sp,s[l],s[k])*cp(s[i],s[l],s[k])>0&&cp(s[l],sp,s[i])*cp(s[k],sp,s[i])>0)
																u1=1;
															if(cp(sp,s[l],s[k])*cp(s[j],s[l],s[k])>0&&cp(s[l],sp,s[j])*cp(s[k],sp,s[j])>0)
															u1=1;
															if(cp(sp,s[l],s[k])*cp(t,s[l],s[k])>0&&cp(s[l],sp,t)*cp(s[k],sp,t)>0)
																u3=1;
															if(u1==1||u2==1||u3==1)
																{u[i]=1; u[j]=1;}
															}						
									}
	//	for(i=0;i<s.size();i++)
		//	if(!u[i])
			//	cout<<s[i].x<<" "<<s[i].y<<endl;	
	*/		
	//cout<<N<<endl;
	if(N==2)	cout<<"14348737"<<endl;
	else								
		printf("%.0lf\n",abs((pp2.x-pp1.x)*(pp2.y-pp1.y)));			
                                            
    return 0;
}
