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;
namespace Fread {
const int MAXN = 1 << 20;
char buffer[MAXN], *S, *T;
inline char getchar() {
  if (S == T) {
    T = (S = buffer) + fread(buffer, 1, MAXN, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
}  // namespace Fread
inline int read() {
  int f = 1, x = 0;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = Fread::getchar();
  }
  return x * f;
}
inline long long readll() {
  long long f = 1, x = 0;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = Fread::getchar();
  }
  return x * f;
}
const int MAXN = 3005;
struct EDGE {
  int nxt, to;
} edge[MAXN << 1];
int head[MAXN], tot;
inline void add_edge(int u, int v) {
  edge[++tot].nxt = head[u];
  edge[tot].to = v;
  head[u] = tot;
}
int n, sta[MAXN], top, cir[MAXN], c;
bool vis[MAXN], flag, incir[MAXN];
void dfs1(int u, int frm) {
  vis[u] = 1;
  sta[++top] = u;
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].to;
    if (v == frm) continue;
    if (vis[v]) {
      int t = -1;
      for (int j = 1; j <= top; ++j)
        if (sta[j] == v) {
          t = j;
          break;
        }
      assert(t != -1);
      for (int j = t; j <= top; ++j) cir[++c] = sta[j];
      flag = 1;
      return;
    }
    dfs1(v, u);
    if (flag) return;
  }
  --top;
}
int fa[MAXN], d[MAXN], rt;
vector<int> tr[MAXN];
void dfs2(int u) {
  tr[rt].push_back(u);
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].to;
    if (v == fa[u] || incir[v]) continue;
    fa[v] = u;
    d[v] = d[u] + 1;
    dfs2(v);
  }
}
double ans;
void dfs3(int u, int frm, int dep) {
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].to;
    if (incir[u] && incir[v]) continue;
    if (v == frm) continue;
    ans += 1.0 / (dep + 1);
    dfs3(v, u, dep + 1);
  }
}
int main() {
  n = read();
  for (int i = 1, u, v; i <= n; ++i)
    u = read() + 1, v = read() + 1, add_edge(u, v), add_edge(v, u);
  dfs1(1, 0);
  assert(flag);
  for (int i = 1; i <= c; ++i) incir[cir[i]] = 1;
  for (int i = 1; i <= c; ++i) {
    fa[cir[i]] = 0;
    rt = cir[i];
    dfs2(cir[i]);
  }
  ans = n;
  for (int i = 1; i <= n; ++i) {
    dfs3(i, 0, 1);
  }
  for (int i = 1; i <= c; ++i) {
    for (int j = 0; j < (int)tr[cir[i]].size(); ++j) {
      int u = tr[cir[i]][j];
      for (int k = 1; k <= c; ++k)
        if (k != i) {
          int dis1 = max(i, k) - min(i, k), dis2 = c - dis1;
          for (int l = 0; l < (int)tr[cir[k]].size(); ++l) {
            int v = tr[cir[k]][l];
            ans += 1.0 / (d[u] + d[v] + dis1 + 1);
            ans += 1.0 / (d[u] + d[v] + dis2 + 1);
            ans -= 1.0 / (d[u] + d[v] + c);
          }
        }
    }
  }
  cout << setiosflags(ios::fixed) << setprecision(10) << ans << endl;
  return 0;
}