//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

double x[105], y[105], a[4], b[4];

//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
// line
struct L : public vector<P> {
	L(const P& a, const P& b) {
		push_back(a); push_back(b);
	}
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;								  // a--c--b on line
}

bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

// polygon
typedef vector<P> G;

enum { OUT, ON, IN };
int contains(const G& po, const P& p) {
  bool in = false;
  for (int i = 0; i < po.size(); ++i) {
  	P a = po[i] - p, b = po[(i+1)%po.size()] - p;
    if (imag(a) > imag(b)) swap(a, b);
    if (imag(a) <= 0 && 0 < imag(b))
      if (cross(a, b) < 0) in = !in;
    if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;
  }
  return in ? IN : OUT;
}

double area2(const G& po) {
	double A = 0;
  	for (int i = 0; i < po.size(); ++i)
    	A += cross(po[i], po[(i+1)%po.size()]);
	//?????????|????????????????????????????????????????????????
  	return A/2;
}

P p[105];
vector<L> l;
signed main(void)
{
  while(true) {
    int n;
    cin >> n;
    if(!n) break;

    G all;
    REP(i, n) {
      cin >> x[i] >> y[i];
      p[i] = P{x[i], y[i]};
      all.PB(p[i]);
    }
    vector<pair<double, double>> c[2];
    // right 0 ue 1 left 2 sita 3
    int d[4];
    REP(i, 4) cin >> a[i] >> b[i];
    REP(i, 4) {
      if(a[i] == a[(i+1)%4]) {
        if(c[0].size() == 0) c[0].PB(MP(a[i], i));
        else {
          if(c[0][0].first > a[i]) d[i] = 2, d[(int)c[0][0].second] = 0;
          else d[i] = 0, d[(int)c[0][0].second] = 2;
        }
      } else {
        if(c[1].size() == 0) c[1].PB(MP(b[i], i));
        else {
          if(c[1][0].first > b[i]) d[i] = 3, d[(int)c[1][0].second] = 1;
          else d[i] = 1, d[(int)c[1][0].second] = 3;
        }
      }
    }
    //REP(i, 4) cout << d[i] << " "; cout << endl;

    REP(i, 4) {
      REP(j, n) {
        if(d[i] == 0) {
          x[j] = min(x[j], a[i]);
        } else if(d[i] == 1) {
          y[j] = min(y[j], b[i]);
        } else if(d[i] == 2) {
          x[j] = max(x[j], a[i]);
        } else {
          y[j] = max(y[j], b[i]);
        }
      }
    }
    G in;
    REP(i, n) {
      //cout << x[i] << " " << y[i] << endl;
      in.PB(P{x[i], y[i]});
    }

    //cout << area2(all) << " " << area2(in) << endl;
    cout << (ll)area2(all) - (ll)area2(in) << endl;
  }

  return 0;
}

Measured memory_bytes: 3208