import java.awt.geom.*;
import java.awt.*;
import java.io.*;
import java.util.StringTokenizer;

class Polygons {
    public static void main(String[] args) throws IOException {
        new Polygons().run();
    }

    static int intval(String s) { return Integer.parseInt(s); }

    public void run() throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int which = 0;
        Polygon[] polys = new Polygon[2];

        while(true) {
            StringTokenizer tk = new StringTokenizer(in.readLine().trim());
            int np = intval(tk.nextToken());
            if(np == 0) break;

            polys[which] = new Polygon();

            // Read in |np| points, add to a Polygon
            for(int i = 0; i < np; ++i) {
                int px = intval(tk.nextToken());
                int py = intval(tk.nextToken());
                polys[which].addPoint(px,py);
            }

            if(which == 1) {
                Area a = new Area(polys[0]);
                Area b = new Area(polys[1]);
                a.exclusiveOr(b);
                //if(!a.isPolygonal()) { System.err.println("Eep! non-polygonal xor area!"); }
                System.out.printf("%8.2f", areaOf(a));
            }
            which = (which + 1) % 2;
        }
        System.out.printf("\n");
    }

    static double areaOf(Shape s) {
        PathIterator i = s.getPathIterator(null);
        double[] coords = new double[6];
        int r;
        double area = 0.;
        double mx, my, lx, ly, x, y;
        mx= my= lx= ly= 0.; // prevent javac complaints over un-init-ed vars
        while(!i.isDone()) {
            r = i.currentSegment(coords);
            x = coords[0]; y = coords[1];

                   if(r == PathIterator.SEG_LINETO) {
                area += (lx*y - x*ly);
            } else if(r == PathIterator.SEG_CLOSE) {
                area += (lx*my - mx*ly);
            } else if(r == PathIterator.SEG_MOVETO) {
                mx = x;
                my = y;
            }

            lx = x; ly = y;
            i.next();
        }
        return Math.abs(area/2);
    }
}
