#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

const double INF = 1e300;

const int N = 100 + 5;

struct Point {
  double x, y;
};

Point C1[N], C2[N];

double width(const Point c[], int n, double x) {
  double y_min = INF, y_max = -INF;
  for (int i = 0; i < n; ++i) {
    int j = (i + 1) % n;
    double x1 = c[i].x, y1 = c[i].y, x2 = c[j].x, y2 = c[j].y;
    if (x1 != x2 && (x1 - x) * (x2 - x) <= 0.0) {
      double y = y1 + (x - x1) / (x2 - x1) * (y2 - y1);
      y_min = min(y_min, y);
      y_max = max(y_max, y);
    }
  }
  return max(0.0, y_max - y_min);
}

int main() {
#ifdef DEBUG
  freopen("in.txt", "r", stdin);
#endif

  int n, m;
  while (scanf("%d%d", &n, &m) != EOF && n && m) {
    vector<double> xs;
    double min_x1 = INF, max_x1 = -INF, min_x2 = INF, max_x2 = -INF;

    for (int i = 0; i < n; ++i) {
      scanf("%lf%lf", &C1[i].x, &C1[i].y);
      xs.push_back(C1[i].x);
      min_x1 = min(min_x1, C1[i].x);
      max_x1 = max(max_x1, C1[i].x);
    }

    for (int i = 0; i < m; ++i) {
      scanf("%lf%lf", &C2[i].x, &C2[i].y);
      xs.push_back(C2[i].x);
      min_x2 = min(min_x2, C2[i].x);
      max_x2 = max(max_x2, C2[i].x);
    }

    sort(xs.begin(), xs.end());

    double V = 0.0;
    for (size_t i = 0; i + 1 < xs.size(); ++i) {
      double a = xs[i], b = xs[i + 1], c = (a + b) / 2.0;
      if ((min_x1 <= c && c <= max_x1) &&
          (min_x2 <= c && c <= max_x2)) {
        double fa = width(C1, n, a) * width(C2, m, a);
        double fb = width(C1, n, b) * width(C2, m, b);
        double fc = width(C1, n, c) * width(C2, m, c);
        V += (b - a) / 6 * (fa + 4 * fc + fb);
      }
    }
    printf("%.10f\n", V);
  }

  return 0;
}

