Problem: Problem

Satake doesn't like being bent.
For example, I don't like pencils, chopsticks, and bent-shaped houses, and I don't like taking actions such as turning right or left.

By the way, Satake who lives on the XY plane is $ N $ shops $ (X_ {1}, Y_ {1}), (X_ {2}, Y_ {2}), \ ldots, (X_ {N} , Y_ {N}) I was asked to shop for $. Depart from the house at coordinates $ (0, 0) $ in the direction of $ (1, 0) $, shop at all stores, and then return home. You can go around the shops in any order. As a user, Satake can perform any of the following actions as many times as you like.

1. Go as much as you like in the direction you are facing
2. When the coordinates are the same as the shop or house, rotate clockwise or counterclockwise by the desired angle on the spot.
3. When the coordinates are the same as the store, shop while maintaining the coordinates and the direction in which they are facing.



As I said earlier, Satake doesn't like to bend. To prepare your mind, find the minimum sum of the angles that Satake will rotate in Action 2. As an example, if you rotate $ 90 ^ {\ circ} $ clockwise and then $ 90 ^ {\ circ} $ counterclockwise, the sum of the angles will be $ 180 ^ {\ circ} $.

Constraints

The input meets the following conditions:

* $ 2 \ le N \ le 8 $
* $ -1000 \ le X_ {i}, Y_ {i} \ le 1000 \ quad (1 \ le i \ le N) $
* $ (X_ {i}, Y_ {i}) \ ne (0, 0) \ quad (1 \ le i \ le N) $
* $ (X_ {i}, Y_ {i}) \ ne (X_ {j}, Y_ {j}) \ quad (i \ ne j) $
* All inputs are integers

Input

The input is given in the following format:


$ N $
$ X_ {1} $ $ Y_ {1} $
$ \ vdots $
$ X_ {N} $ $ Y_ {N} $


The input consists of $ N + 1 $ lines.
The $ 1 $ line is given $ N $, which represents the number of stores to shop.
The $ N $ line starting from the $ 2 $ line is given the coordinates $ X_ {i}, Y_ {i} $ of the store where you shop, separated by blanks.

Output

Please output the minimum value of the sum of the angles that Satake rotates in degrees. However, the correct answer is given only when the absolute error from the assumed solution is $ 10 ^ {-4} $ or less.

Examples

Input

2
0 1
0 -1


Output

450.00000000


Input

3
1 0
0 1
-2 -1


Output

386.565051

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

using Real = long double;
using Point = complex<Real>;
const Real Pi = acos(-1), EPS = 1e-9;
inline bool eq(Real a, Real b) { return fabs(a - b) < EPS; }

//scalar
Point operator*(const Point &p, const Real &c)
{
    return Point(c * real(p), c * imag(p));
}

//add
Point operator+(const Point &p, const Point &q)
{
    return Point(real(p) + real(q), imag(p) + imag(q));
}

Point operator-(const Point &p, const Point &q)
{
    return Point(real(p) - real(q), imag(p) - imag(q));
}

//equal
bool operator==(const Point &p, const Point &q)
{
    return (real(p) == real(q)) && (imag(p) == imag(q));
}

Real radian_to_degree(Real r)
{
    return (r * 180.0 / Pi);
}

Real degree_to_radian(Real d)
{
    return (d * Pi / 180.0);
}

// norm
Real norm(const Point &p)
{
    return real(p) * real(p) + imag(p) * imag(p);
}

Real abs(const Point &p)
{
    return sqrt(norm(p));
}

//argumant [0, 2 * Pi)
Real arg(const Point &p)
{
    Real a = atan2(imag(p), real(p));
    if (a < 0)
        a = fabs(a) + Pi;
    return a;
}

Real dot(const Point &p, const Point &q)
{
    return (real(p) * real(q) + imag(p) * imag(q));
}

//input
istream &operator>>(istream &is, Point &p)
{
    Real a, b;
    is >> a >> b;
    p = Point(a, b);
    return is;
}

//output
ostream &operator<<(ostream &os, Point &p)
{
    os << fixed << setprecision(10) << p.real() << " " << p.imag();
}

Real get_angle(Point a, Point b)
{
    return acos(dot(a, b) / (abs(a) * abs(b)));
}

int N;

int main()
{
    cin >> N;
    vector<Point> X(N);
    for (int i = 0; i < N; i++)
    {
        cin >> X[i];
    }

    vector<int> index(N);
    for (int i = 0; i < N; i++)
    {
        index[i] = i;
    }

    long double ans = 1e6;

    do
    {
        Point now_vect(0.5, 0.); //今向いている方向
        long double res = 0.;
        for (int i = 0; i < N; i++)
        {
            Point next_vect = (i == 0 ? X[index[i]] : X[index[i]] - X[index[i - 1]]);
            res += get_angle(now_vect, next_vect);
            now_vect = next_vect;
        }
        Point next_vect = -X[index[N - 1]];
        res += get_angle(now_vect, next_vect);
        ans = min(ans, res);
    } while (next_permutation(index.begin(), index.end()));

    cout << fixed << setprecision(10);
    cout << radian_to_degree(ans) << endl;
}