#include <bits/stdc++.h>
using namespace std;
using ll = long long;

double eps = 0.0000000000001;
using p2 = complex<double>;

double det(p2 v1, p2 v2) {
  return v1.real() * v2.imag() - v1.imag() * v2.real();
}

double dot(p2 v1, p2 v2) {
  return v1.real() * v2.real() + v1.imag() * v2.imag();
}

bool same(double x, double y) { return abs(x - y) < eps; }
double dist2(p2 l1, p2 l2) { return dot(l1 - l2, l1 - l2); }
double dist(p2 l1, p2 l2) { return sqrt(dist2(l1, l2)); }

struct Line {
  p2 st, ed;
  Line(p2 st, p2 ed) : st(st), ed(ed) {}
  bool isPalla(Line l) { return abs(det(ed - st, l.ed - l.st)) < eps; }
  double dist() { return sqrt(dist2(st, ed)); }
  double x() { return ed.real() - st.real(); }
  double y() { return ed.imag() - st.imag(); }
  p2 xy() { return p2(x(), y()); }
};

pair<double, double> interP(Line l1, Line l2) {
  double a = l1.x();
  double b = -l2.x();
  double c = l1.y();
  double d = -l2.y();
  double inv = 1. / (a * d - c * b);
  double e1 = -l1.st.real() + l2.st.real();
  double e2 = -l1.st.imag() + l2.st.imag();
  return make_pair((d * e1 - b * e2) * inv, (-c * e1 + a * e2) * inv);
}

p2 inter(Line l1, Line l2) {
  auto r = interP(l1, l2);
  return p2(l1.st.real() + r.first * l1.x(), l1.st.imag() + r.first * l1.y());
}

bool upper(p2 v1, p2 v2) { return det(v1, v2) > -eps; }

double dist(p2 p) { return sqrt(p.real() * p.real() + p.imag() * p.imag()); }

double compy = 0.;
bool fn(const p2 &v1, const p2 &v2) {
  p2 comp(0, compy);
  double k1 = det(v1, comp) / dist(v1) / dist(comp);
  double k2 = det(v2, comp) / dist(v2) / dist(comp);
  return k1 > k2;
}
bool com(const p2 &v1, const p2 &v2) {
  double a1 = (v1.imag() - compy) / v1.real();
  double a2 = (v2.imag() - compy) / v2.real();
  return a1 < a2;
}

int main() {
  while (true) {
    double w, h;
    int n;
    cin >> w >> h >> n;
    if (n == 0)
      break;
    vector<p2> ps;
    for (int i = 0; i < 2 * n; i++) {
      double x, y;
      cin >> x >> y;
      ps.push_back(p2(x, y));
    }
    n += 1;
    ps.push_back(p2(w, 0));
    ps.push_back(p2(w, h));
    Line l(p2(0, 0), p2(0, h)), l2(p2(w, 0), p2(w, h));

    vector<double> y;
    for (int i = 0; i < 2 * n; i++)
      for (int j = i + 1; j < 2 * n; j++) {
        Line s(ps[i], ps[j]);
        if (l.isPalla(s))
          continue;
        p2 p = inter(l, s);
        if (-eps < p.imag() && p.imag() < h + eps) {
          y.push_back(p.imag());
        }
      }
    y.push_back(0);
    y.push_back(h);
    sort(y.begin(), y.end());

    double ans = 0.;

    for (int i = 1; i < y.size(); i++) {
      double my = (y[i - 1] + y[i]) / 2;

      p2 pn(-1, -1), pn1(-1, -1);
      compy = my;
      sort(ps.begin(), ps.end(), com);

      pn = ps[n];
      pn1 = ps[n - 1];

      Line lp(p2(0, my), pn);
      if (lp.isPalla(l2))
        continue;
      p2 vp = inter(lp, l2);

      Line lpp(p2(0, my), pn1);
      if (lpp.isPalla(l2))
        continue;
      p2 vpp = inter(lpp, l2);

      if (vp.imag() > h + eps || vpp.imag() > h + eps || vp.imag() < -eps ||
          vpp.imag() < -eps)
        continue;

      /*
      for (int i = 0; i < 2 * n; i++) {
        p2 v(Line(p2(0, my), ps[i]).xy());
        int c = 0;
        for (int j = 0; j < 2 * n; j++) {
          if (upper(v, Line(p2(0, my), ps[j]).xy())) {
            c++;
          }
        }
        if (n == c) {
          pn = ps[i];
        }
        if (n + 1 == c) {
          pn1 = ps[i];
        }
      }
      if (pn.imag() < -eps || pn1.imag() < -eps || pn.real() < -eps ||
          pn1.real() < -eps)
        continue;
        */

      double H = y[i];
      double L = y[i - 1];
      double x1 = pn1.real();
      double y1 = pn1.imag();
      double x2 = pn.real();
      double y2 = pn.imag();

      ans += w / h *
             ((y2 / x2 - y1 / x1) * (H - L) -
              ((H * H - L * L) / x2 - (H * H - L * L) / x1) / 2);
    }
    ans /= h;
    printf("%.12lf\n", ans);
  }
  return 0;
}


Measured memory_bytes: 3436