Problem: Mr. Nod is an astrologist and has defined a new constellation. He took two photos of the constellation to foretell a future of his friend. The constellation consists of n stars. The shape of the constellation in these photos are the same, but the angle of them are different because these photos were taken on a different day. He foretells a future by the difference of the angle of them.

Your job is to write a program to calculate the difference of the angle of two constellation.



Input

The input is a sequence of datasets. Each dataset is given in the following format:


n
x1,1 y1,1
...
x1,n y1,n
x2,1 y2,1
...
x2,n y2,n


The first line of each dataset contains a positive integers n (n ≤ 1,000). The next n lines contain two real numbers x1,i and y1,i (|x1,i|, |y1,i| ≤ 100), where (x1,i , y1,i) denotes the coordinates of the i-th star of the constellation in the first photo. The next n lines contain two real numbers x2,i and y2,i (|x2,i|, |y2,i| ≤ 100), where (x2,i , y2,i ) denotes the coordinates of the i-th star of the constellation in the second photo.

Note that the ordering of the stars does not matter for the sameness. It is guaranteed that distance between every pair of stars in each photo is larger than 10-5.

The input is terminated in case of n = 0. This is not part of any datasets and thus should not be processed.

Output

For each dataset, you should print a non-negative real number which is the difference of the angle of the constellation in the first photo and in the second photo. The difference should be in radian, and should not be negative. If there are two or more solutions, you should print the smallest one. The difference may be printed with any number of digits after decimal point, provided the absolute error does not exceed 10-7. No extra space or character is allowed.

Example

Input

3
0.0 0.0
1.0 1.0
0.0 1.0
3.0 3.0
2.0 2.0
3.0 2.0
0


Output

3.14159265359

Solution (in CPP):

Solution:
#include <cstdio>
#include <vector>
#include <complex>
#include <cmath>
#include <algorithm>
using namespace std;
typedef complex<double> P;
static const double EPS = 1e-6;
static const double PI = acos(-1.0);
namespace std {
  bool operator<(const P& a, const P& b)
  {
    if (fabs(a.real() - b.real()) < EPS) {
      return a.imag() < b.imag() - EPS;
    } else {
      return a.real() < b.real() - EPS;
    }
  }
};
inline double dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

void move_to_origin(vector<P>& ps)
{
  P p(0, 0);
  for (vector<P>::const_iterator it = ps.begin(); it != ps.end(); ++it) {
    p += *it;
  }
  p /= ps.size();
  for (vector<P>::iterator it = ps.begin(); it != ps.end(); ++it) {
    *it -= p;
  }
}

vector<P> rot(const vector<P>& ps, double theta)
{
  const P p = polar(1.0, theta);
  vector<P> ans;
  for (vector<P>::const_iterator it = ps.begin(); it != ps.end(); ++it) {
    ans.push_back(*it * p);
  }
  sort(ans.begin(), ans.end());
  return ans;
}

bool equal(const vector<P>& ps, const vector<P>& qs)
{
  const int N = ps.size();
  for (int i = 0; i < N; i++) {
    if (abs(ps[i] - qs[i]) > EPS) {
      return false;
    }
  }
  return true;
}

int main()
{
  int N;
  while (scanf("%d", &N) != EOF && N != 0) {
    vector<P> ps, qs;
    for (int i = 0; i < N; i++) {
      double x, y;
      scanf("%lf %lf", &x, &y);
      ps.push_back(P(x, y));
    }
    for (int i = 0; i < N; i++) {
      double x, y;
      scanf("%lf %lf", &x, &y);
      qs.push_back(P(x, y));
    }

    move_to_origin(ps);
    move_to_origin(qs);
    sort(ps.begin(), ps.end());
    const double arg0 = fmod(arg(ps[0]) + 2*PI, 2*PI);
    double ans = 100;
    for (int i = 0; i < N; i++) {
      const double theta = arg0 - fmod(arg(qs[i]) + 2*PI, 2*PI);
      const vector<P> rs = rot(qs, theta);
      if (equal(ps, rs)) {
        const double t = fabs(theta);
        ans = min(ans, min(t, 2*PI-t));
      }
    }
    printf("%.7f\n", ans);
  }
  return 0;
}