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:
/*  -*- coding: utf-8 -*-
 *
 * 3066.cc: Satake likes straight
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 9;
const int NBITS = 1 << MAX_N;
const double PI = acos(-1.0);
const double DINF = 1e60;

/* typedef */

template <typename T>
struct Pt {
  T x, y;

  Pt() {}
  Pt(T _x, T _y) : x(_x), y(_y) {}
  Pt(const Pt<T> &pt) : x(pt.x), y(pt.y) {}

  Pt<T> operator+(const Pt<T> pt) const { return Pt<T>(x + pt.x, y + pt.y); }
  Pt<T> operator-() const { return Pt<T>(-x, -y); }
  Pt<T> operator-(const Pt<T> pt) const { return Pt<T>(x - pt.x, y - pt.y); }
  Pt<T> operator*(T t) const { return Pt<T>(x * t, y * t); }
  Pt<T> operator/(T t) const { return Pt<T>(x / t, y / t); }
  T dot(Pt<T> v) const { return x * v.x + y * v.y; }
  T cross(Pt<T> v) const { return x * v.y - y * v.x; }
  Pt<T> mid(const Pt<T> pt) { return Pt<T>((x + pt.x) / 2, (y + pt.y) / 2); }
  T d2() { return x * x + y * y; }
  double d() { return sqrt(d2()); }

  Pt<T> normalize() {
    double d0 = d();
    return (d0 != 0.0) ? Pt<T>(x / d0, y / d0) : *this;
  }

  void print() { printf("(%d,%d)", x, y); }
};

typedef Pt<double> pt;

/* global variables */

pt ps[MAX_N], nvs[MAX_N][MAX_N];
double dp[NBITS][MAX_N][MAX_N];

/* subroutines */

inline void setmin(double &a, double b) { if (a > b) a = b; }

/* main */

int main() {
  int n;
  scanf("%d", &n);
  n++;

  ps[0] = pt(0.0, 0.0);
  for (int i = 1; i < n; i++) scanf("%lf%lf", &ps[i].x, &ps[i].y);

  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i != j)
	nvs[i][j] = (ps[j] - ps[i]).normalize();

  int nbits = 1 << n;
  for (int bits = 0; bits < nbits; bits++)
    for (int i = 0; i < n; i++)
      fill(dp[bits][i], dp[bits][i] + n, DINF);

  for (int i = 1, bi = 1 << 1; i < n; i++, bi <<= 1)
    dp[1 | bi][0][i] = acos(nvs[0][i].x);

  for (int bits = 0; bits < nbits; bits++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
	if (dp[bits][i][j] < DINF)
	  for (int k = 0, bk = 1; k < n; k++, bk <<= 1)
	    if (! (bits & bk))
	      setmin(dp[bits | bk][j][k],
		     dp[bits][i][j] + acos(nvs[i][j].dot(nvs[j][k])));

  double mind = DINF;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (dp[nbits - 1][i][j] < DINF)
	setmin(mind, dp[nbits - 1][i][j] + acos(nvs[i][j].dot(nvs[j][0])));

  printf("%.8lf\n", mind * 180 / PI);
  return 0;
}