#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

void Calc(double ys[2][210], pair<double, double> vys[410], int n) {
  REP(i, 210) {
    ys[0][i] = 1e+100;
    ys[1][i] = -1e+100;
  }
  REP(i, n) {
    int px = vys[i].first;
    int nx = vys[i + 1].first;
    double py = vys[i].second;
    double ny = vys[i + 1].second;
    if (px > nx) { swap(px, nx); swap(py, ny); }
    if (px == nx) { continue; }
    FOREQ(x, px, nx) {
      double d1 = abs(x - px);
      double d2 = abs(nx - x);
      double y = (py * d2 + ny * d1) / (d1 + d2);
      ys[0][x + 100] = min(ys[0][x + 100], y);
      ys[1][x + 100] = max(ys[1][x + 100], y);
    }
  }
}

double CalcVolume(int x, double py, double ny, double pz, double nz) {
  double f1 = py * pz;
  double f2 = (py + ny) / 2.0 * (pz + nz) / 2.0;
  double f3 = ny * nz;
  double ret = (f1 + 4 * f2 + f3) / 6.0;
  return ret;
}

pair<double, double> vys[410];
pair<double, double> vzs[410];
int n, m;
double ys[2][210];
double zs[2][210];

int main() {
  while (scanf("%d %d", &m, &n), n|m) {
    MEMSET(vys, 0);
    MEMSET(vzs, 0);
    REP(i, m) {
      int x, y;
      scanf("%d %d", &x, &y);
      vys[i + m] = vys[i] = make_pair(x, y);
    }
    REP(i, n) {
      int x, z;
      scanf("%d %d", &x, &z);
      vzs[i + n] = vzs[i] = make_pair(x, z);
    }
    Calc(ys, vys, m);
    Calc(zs, vzs, n);
    double ans = 0.0;
    for (double x = 0; x <= 200; x += 1) {
      int px = x;
      int nx = x + 1;
      if (ys[0][px] > ys[1][px] ||
          ys[0][nx] > ys[1][nx] ||
          zs[0][px] > zs[1][px] ||
          zs[0][nx] > zs[1][nx]) { continue; }
      ans += CalcVolume(x - 100,
                        ys[1][px] - ys[0][px], ys[1][nx] - ys[0][nx],
                        zs[1][px] - zs[0][px], zs[1][nx] - zs[0][nx]);
    }
    printf("%.8f\n", ans);
  }
}