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
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
struct Point {
	double x, y;
	struct Vector operator-(const Point& that) const;
	double distance_from(const Point& that) const;
};
struct Vector {
	double dx, dy;
	double dot(const Vector& that) const;
	double cross(const Vector& that)const;
	double length() const;
	struct Angle to_angle() const;
	struct Angle angle_with(const Vector& that) const;
	Vector rotate(const struct Angle& angle) const;
	Vector operator-(const Vector& that) const;
};
struct Angle {
	double sin, cos;
	double to_radian() const;
	Angle operator-() const;
};
int main() {
	std::vector<double> result;
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::vector<Point> before_points(n), after_points(n);
		for (auto& point : before_points) std::cin >> point.x >> point.y;
		for (auto& point : after_points) std::cin >> point.x >> point.y;
		if (n == 1) {
			//std::cout << 0 << '\n';
			result.push_back(0);
			continue;
		}
		const auto origin = *std::min_element(before_points.begin(), before_points.end(), [](const Point& a, const Point& b) {return (a.y != b.y) ? a.y < b.y : a.x < b.x; });
		std::vector<Vector> before_vec; before_vec.reserve(n - 1);
		for (const auto& point : before_points) {
			if (origin.distance_from(point) > 1e-9) before_vec.push_back(point - origin);
		}
		const auto base = *std::max_element(before_vec.begin(), before_vec.end(), [](const Vector& a, const Vector& b) {return std::abs(a.cross(b)) <= 1e-9 ? a.length() < b.length() : a.cross(b) < 0; });
		const auto angle = base.to_angle();
		for (auto& vec : before_vec) vec = vec.rotate(-angle); 
		std::sort(before_vec.begin(), before_vec.end(), [base](const Vector& a, const Vector& b) { return std::abs(a.cross(b)) < 1e-12 ? a.length() < b.length() : a.cross(b) < 0; });
		double min_radian = DBL_MAX;
		for (auto i = 0; i < n; ++i) {
			std::vector<Vector> after_mapped; after_mapped.reserve(n - 1);
			for (auto j = 0; j < n; ++j) if (i != j) after_mapped.push_back(after_points[j] - after_points[i]);
			const auto new_base = *std::max_element(after_mapped.begin(), after_mapped.end(), [](const Vector& a, const Vector& b) {return std::abs(a.cross(b)) <= 1e-9 ? a.length() < b.length() : a.cross(b) < 0; });
			const auto new_angle = new_base.to_angle();
			for (auto& vec : after_mapped) vec = vec.rotate(-new_angle);
			if (std::any_of(after_mapped.begin(), after_mapped.end(), [](const Vector& a) {return a.dy < -1e-9; }))
				continue;
			std::sort(after_mapped.begin(), after_mapped.end(), [](const Vector& a, const Vector& b) { return std::abs(a.cross(b)) < 1e-12 ? a.length() < b.length() : a.cross(b) < 0; });
			bool is_match = true;
			for (auto j = 0; j < n - 1; ++j) {
				if ((after_mapped[j] - before_vec[j]).length() > 1e-6) {
					is_match = false;
					break;
				}
			}
			if (is_match) {
				min_radian = std::min(min_radian, std::acos(base.angle_with(new_base).cos));
			}
		}
		//std::cout << std::setprecision(15) << std::fixed << min_radian << '\n';
		result.push_back(min_radian);
	}
	for (const auto r : result) {
		std::cout << std::setprecision(10) << std::fixed << r << '\n';
	}
}


Vector Point::operator-(const Point& that) const
{
	return Vector{ x - that.x, y - that.y };
}

double Point::distance_from(const Point& that) const
{
	return (*this - that).length();
}

double Vector::dot(const Vector& that) const
{
	return dx * that.dx + dy * that.dy;
}

double Vector::cross(const Vector& that) const
{
	return dx * that.dy - dy * that.dx;
}

double Vector::length() const
{
	return std::sqrt(dx * dx + dy * dy);
}

Angle Vector::to_angle() const
{
	const auto len = length();
	return Angle{ dy / len, dx / len };
}

Angle Vector::angle_with(const Vector& that) const
{
	const auto len = length() * that.length();
	return Angle{ cross(that) / len, dot(that) / len };
}

Vector Vector::rotate(const Angle& angle) const
{
	return Vector{ dx * angle.cos - dy * angle.sin, dy * angle.cos + dx * angle.sin };
}

Vector Vector::operator-(const Vector& that) const
{
	return Vector{ dx - that.dx, dy - that.dy };
}

double Angle::to_radian() const
{
	return (sin >= 0) ? std::acos(cos) : std::acos(-1) * 2 - std::acos(cos);
}

Angle Angle::operator-() const
{
	return Angle{ -sin, cos };
}
