Problem: The Minister for education is coming! Naturally, nobody wants to perform poorly in front of such a honored guest. However, two hours before the arrival it turned out that one of the classes has a malfunctioning lightbulb — for some reason it doesn't get enough energy. The solution was found quickly: all we've got to do is to change the location of the lightbulb so that it got the maximum amount of energy.

Everybody knows that the power of the lightbulb equals <image>, where C is some constant value and ri is the Euclidean distance from the bulb to the i-th generator. Consequently, our task is to minimize <image>. Of course, we know the positions of all generators.

The bulb should be on the ceiling of the class. The ceiling of the class is in the form of a strictly convex m-gon (the class itself has the form of a right prism with a strictly convex m-gon at the bottom). Help to find the optimum location for the bulb. Assume that all generators are in the plane of the class ceiling. Consider that the plane of the class ceiling has some Cartesian coordinate system introduced.

Input

The first line contains integer n (2 ≤ n ≤ 105) — the number of generators. Each of the next n lines contains a pair of integers xi, yi, representing the coordinates of the i-th generator in the plane of the class ceiling. It's guaranteed that no two generators have the same location.

The next line contains integer m (3 ≤ m ≤ 105) — the number of vertexes in the convex polygon that describes the ceiling of the class. Each of the following m lines contains a pair of integers pi, qi, representing the coordinates of the i-th point of the polygon in the clockwise order. It's guaranteed that the polygon is strictly convex.

The absolute value of all the coordinates don't exceed 106.

Output

Print a single real number — the minimum value of the sum of squares of distances from the generators to the point of the lightbulb's optimal position. The answer will be considered valid if its absolute or relative error doesn't exceed 10 - 4.

Examples

Input

4
3 2
3 4
5 4
5 2
4
3 3
4 4
5 3
4 2


Output

8.00000000

Note

We'll define a strictly convex polygon as a convex polygon with the following property: no three vertices of the polygon lie on the same line.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct po {
  long double x, y;
  inline po(long double a = 0, long double b = 0) {
    x = a;
    y = b;
  }
} a[110000];
struct func {
  long double a, b, c;
  inline func(po u = po(0, 0), po v = po(0, 0)) {
    long double x1, y1, x2, y2;
    x1 = u.x;
    y1 = u.y;
    x2 = v.x;
    y2 = v.y;
    b = -(x1 - x2);
    a = y1 - y2;
    c = -(a * x1 + b * y1);
  }
  inline bool cross(func v, po &res) {
    long double d, e, f;
    d = v.a;
    e = v.b;
    f = v.c;
    if (fabs(b * d - a * e) < 1e-7) exit(0);
    res.y = (a * f - c * d) / (b * d - a * e);
    res.x = (b * f - c * e) / (a * e - b * d);
    return 1;
  }
  inline long double y(long double x) {
    if (fabs(b) < 1e-7) exit(0);
    return (-c - a * x) / b;
  }
  inline long double x(long double y) {
    if (fabs(a) < 1e-7) exit(0);
    return (-c - b * y) / a;
  }
} b[110000][3];
int tmp[110000];
int n, m;
int zb[110000];
long double B, C, D;
long double ANS = 1e17;
inline void Min(long double &x, long double y) {
  if (y < x) x = y;
}
inline long double f(long double a, long double bb, long double c,
                     long double x) {
  return a * x * x + bb * x + c;
}
inline long double Ask(long double a, long double b, long double c,
                       long double l, long double r) {
  long double dcz = (-b) / (2. * a);
  if (dcz <= r && dcz >= l) return f(a, b, c, dcz);
  long double R = f(a, b, c, l);
  Min(R, f(a, b, c, r));
  return R;
}
inline long double belong(long double l, long double r, func fx) {
  if (fabs(fx.b) < 1e-7) exit(0);
  long double V = -fx.a / fx.b;
  long double W = -fx.c / fx.b;
  return Ask(V * V + 1, 2 * V * W + B + C * V, D + W * W + C * W, l, r);
}
inline long double pq(long double l, long double r, long double papa) {
  return Ask(1, B, papa * papa + papa * C + D, l, r);
}
int main() {
  scanf("%d", &m);
  for (int i = (1); i <= (int)m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    D += x * 1. * x + y * 1. * y;
    C -= 2. * y;
    B -= 2. * x;
  }
  scanf("%d", &n);
  for (int i = (1); i <= (int)n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = po(x, y);
    tmp[i] = x;
  }
  sort(tmp + 1, tmp + 1 + n);
  int N = unique(tmp + 1, tmp + 1 + n) - tmp - 1;
  for (int i = (1); i <= (int)n; i++) {
    a[i].x = lower_bound(tmp + 1, tmp + 1 + N, (int)(a[i].x)) - tmp;
  }
  for (int i = (1); i <= (int)n; i++) {
    func uccu = func(po(tmp[(int)a[i].x], a[i].y),
                     po(tmp[(int)a[i % n + 1].x], a[i % n + 1].y));
    int px, qx;
    px = (int)(a[i].x);
    qx = (int)(a[i % n + 1].x);
    if (px > qx) swap(px, qx);
    for (int j = (px); j <= (int)qx - 1; j++) b[j][++zb[j]] = uccu;
  }
  B /= m;
  C /= m;
  D /= m;
  func uccu = func(po(1, -C / 2.), po(2, -C / 2.));
  long double papa = -C / 2.;
  for (int i = (1); i <= (int)N - 1; i++) {
    long double l = tmp[i];
    long double r = tmp[i + 1];
    if (b[i][1].y(l) >= b[i][2].y(l) && b[i][1].y(r) >= b[i][2].y(r))
      swap(b[i][1], b[i][2]);
    po lu, ru, ld, rd;
    func L = func(po(l, 1), po(l, 2));
    func R = func(po(r, 1), po(r, 2));
    L.cross(b[i][2], lu);
    L.cross(b[i][1], ld);
    R.cross(b[i][2], ru);
    R.cross(b[i][1], rd);
    if (papa >= lu.y && papa >= ru.y) {
      Min(ANS, belong(l, r, b[i][2]));
    } else if (papa <= ld.y && papa <= rd.y) {
      Min(ANS, belong(l, r, b[i][1]));
    } else if (papa <= lu.y && papa >= ld.y && papa <= ru.y && papa >= rd.y) {
      Min(ANS, pq(l, r, papa));
    } else if (papa >= ld.y && papa >= rd.y) {
      po jb;
      jb.y = papa;
      jb.x = b[i][2].x(jb.y);
      if (lu.y <= ru.y) {
        Min(ANS, belong(l, jb.x, b[i][2]));
        Min(ANS, pq(jb.x, r, papa));
      } else {
        Min(ANS, belong(jb.x, r, b[i][2]));
        Min(ANS, pq(l, jb.x, papa));
      }
    } else if (papa <= lu.y && papa <= ru.y) {
      po jb;
      jb.y = papa;
      jb.x = b[i][1].x(jb.y);
      if (ld.y >= rd.y) {
        Min(ANS, belong(l, jb.x, b[i][1]));
        Min(ANS, pq(jb.x, r, papa));
      } else {
        Min(ANS, belong(jb.x, r, b[i][1]));
        Min(ANS, pq(l, jb.x, papa));
      }
    } else {
      po jub, jdb;
      jub.y = jdb.y = papa;
      jub.x = b[i][2].x(papa);
      jdb.x = b[i][1].x(papa);
      if (lu.y <= ru.y) {
        Min(ANS, belong(l, jub.x, b[i][2]));
        Min(ANS, pq(jub.x, jdb.x, papa));
        Min(ANS, belong(jdb.x, r, b[i][1]));
      } else {
        Min(ANS, belong(l, jdb.x, b[i][1]));
        Min(ANS, pq(jdb.x, jub.x, papa));
        Min(ANS, belong(jub.x, r, b[i][2]));
      }
    }
  }
  printf("%.5lf\n", (double)ANS * m);
  return 0;
}