Problem: In computer science, there is a method called "Divide And Conquer By Node" to solve some hard problems about paths on a tree. Let's desribe how this method works by function:

solve(t) (t is a tree): 

  1. Chose a node x (it's common to chose weight-center) in tree t. Let's call this step "Line A". 
  2. Deal with all paths that pass x. 
  3. Then delete x from tree t. 
  4. After that t becomes some subtrees. 
  5. Apply solve on each subtree. 



This ends when t has only one node because after deleting it, there's nothing. 

Now, WJMZBMR has mistakenly believed that it's ok to chose any node in "Line A". So he'll chose a node at random. To make the situation worse, he thinks a "tree" should have the same number of edges and nodes! So this procedure becomes like that.

Let's define the variable totalCost. Initially the value of totalCost equal to 0. So, solve(t) (now t is a graph): 

  1. totalCost = totalCost + (size of t). The operation "=" means assignment. (Size of t) means the number of nodes in t. 
  2. Choose a node x in graph t at random (uniformly among all nodes of t). 
  3. Then delete x from graph t. 
  4. After that t becomes some connected components. 
  5. Apply solve on each component. 



He'll apply solve on a connected graph with n nodes and n edges. He thinks it will work quickly, but it's very slow. So he wants to know the expectation of totalCost of this procedure. Can you help him?

Input

The first line contains an integer n (3 ≤ n ≤ 3000) — the number of nodes and edges in the graph. Each of the next n lines contains two space-separated integers ai, bi (0 ≤ ai, bi ≤ n - 1) indicating an edge between nodes ai and bi.

Consider that the graph nodes are numbered from 0 to (n - 1). It's guaranteed that there are no self-loops, no multiple edges in that graph. It's guaranteed that the graph is connected.

Output

Print a single real number — the expectation of totalCost. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Examples

Input

5
3 4
2 3
2 4
0 4
1 2


Output

13.166666666666666


Input

3
0 1
1 2
0 2


Output

6.000000000000000


Input

5
0 1
1 2
2 0
3 0
4 1


Output

13.166666666666666

Note

Consider the second example. No matter what we choose first, the totalCost will always be 3 + 2 + 1 = 6.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MX = 3500;
int N;
struct Edge {
  int y, nx;
} E[MX << 1];
int H[MX], ec;
void Add(int x, int y) { E[++ec].y = y, E[ec].nx = H[x], H[x] = ec; }
int B[MX], dfn[MX], low[MX], dc;
int Cr[MX], Ic[MX], cc, stk[MX], tp;
void Tarjan(int x, int f) {
  B[x] = 1, dfn[x] = low[x] = ++dc, stk[++tp] = x;
  for (int i = H[x]; i; i = E[i].nx) {
    if (B[E[i].y] == 0)
      Tarjan(E[i].y, x), low[x] = min(low[x], low[E[i].y]);
    else if (E[i].y != f)
      low[x] = min(low[x], dfn[E[i].y]);
  }
  if (dfn[x] == low[x]) {
    if (stk[tp] != x) {
      int z = 0;
      while (z != x) z = stk[tp--], Cr[++cc] = z, Ic[z] = 1;
    } else
      tp--;
  }
}
int C[MX], Ds[MX][MX];
void dfs1(int x, int f, int c) {
  C[x] = c;
  for (int i = H[x]; i; i = E[i].nx)
    if (E[i].y != f && !Ic[E[i].y]) dfs1(E[i].y, x, c);
}
void dfs2(int x, int f, int rt, int d) {
  Ds[rt][x] = d;
  for (int i = H[x]; i; i = E[i].nx)
    if (E[i].y != f && C[x] == C[E[i].y]) dfs2(E[i].y, x, rt, d + 1);
}
double Calc(int x, int y) {
  if (C[x] == C[y]) return 1.0 / Ds[x][y];
  int rx = Cr[C[x]], ry = Cr[C[y]];
  int a = Ds[x][rx] + Ds[y][ry] + (C[x] - C[y] + cc) % cc - 1;
  int b = Ds[x][rx] + Ds[y][ry] + (C[y] - C[x] + cc) % cc - 1;
  int c = Ds[x][rx] + Ds[y][ry] + cc - 2;
  return 1.0 / a + 1.0 / b - 1.0 / c;
}
int main() {
  scanf("%d", &N);
  for (int i = (1); i <= (N); ++i) {
    int x, y;
    scanf("%d%d", &x, &y), ++x, ++y;
    Add(x, y), Add(y, x);
  }
  Tarjan(1, 0);
  for (int i = (1); i <= (cc); ++i) dfs1(Cr[i], 0, i);
  for (int i = (1); i <= (N); ++i) dfs2(i, 0, i, 1);
  double ans = 0;
  for (int i = (1); i <= (N); ++i)
    for (int j = (1); j <= (N); ++j) ans += Calc(i, j);
  printf("%.10f\n", ans);
  return 0;
}