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;
stack<int> st;
int head[333000], cnt, ins[333000], is[333000], c[333000], id[333000], le,
    vis[333000], ntt[333000], s1[333000], s2[333000], s3[333000], s4[333000],
    s5[333000], sth[2220000 * 5], lb[333000], len[333000], rev[333000], n, m, a,
    b, ds[333000], mx1, vl, as, sz[333000], mx2, ct2;
struct edge {
  int t, next;
} ed[333000 * 2];
void adde(int f, int t) {
  ed[++cnt] = (edge){t, head[f]};
  head[f] = cnt;
  ed[++cnt] = (edge){f, head[t]};
  head[t] = cnt;
}
int pw(int a, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = 1ll * ans * a % 998244353;
    a = 1ll * a * a % 998244353;
    p >>= 1;
  }
  return ans;
}
void dft(int s, int *a, int t) {
  for (int i = 0; i < s; i++) rev[i] = (rev[i >> 1] >> 1) + (i & 1) * s / 2;
  for (int i = 0; i < s; i++) ntt[rev[i]] = a[i];
  for (int l = 2; l <= s; l <<= 1) {
    int s1 = pw(3, (998244353 - 1) / l);
    if (t == -1) s1 = pw(s1, 998244353 - 2);
    for (int j = 0; j < s; j += l)
      for (int k = j, st = 1; k < j + (l >> 1);
           k++, st = 1ll * st * s1 % 998244353) {
        int a1 = ntt[k], a2 = 1ll * ntt[k + (l >> 1)] * st % 998244353;
        ntt[k] = a1 + a2 - (a1 + a2 >= 998244353 ? 998244353 : 0);
        ntt[k + (l >> 1)] = a1 - a2 + (a1 < a2 ? 998244353 : 0);
      }
  }
  int inv = pw(s, t == -1 ? 998244353 - 2 : 0);
  for (int i = 0; i < s; i++) a[i] = 1ll * ntt[i] * inv % 998244353;
}
void dfs0(int u, int fa) {
  ins[u] = 1;
  st.push(u);
  for (int i = head[u]; i && !le; i = ed[i].next)
    if (ed[i].t != fa) {
      if (ins[ed[i].t]) {
        while (1) {
          int a = st.top();
          st.pop();
          c[++le] = a;
          if (a == ed[i].t) break;
        }
      } else
        dfs0(ed[i].t, u);
    }
  if (!st.empty() && st.top() == u) st.pop();
}
void dfs1(int u, int fa) {
  sz[u] = 1;
  int mx = 0;
  for (int i = head[u]; i; i = ed[i].next)
    if (ed[i].t != fa && !vis[ed[i].t])
      dfs1(ed[i].t, u), mx = max(mx, sz[ed[i].t]), sz[u] += sz[ed[i].t];
  mx = max(mx, vl - sz[u]);
  if (mx < mx1) mx1 = mx, as = u;
}
void dfs2(int u, int fa) {
  ds[u] = ds[fa] + 1;
  s2[ds[u]]++;
  if (mx2 < ds[u]) mx2 = ds[u];
  for (int i = head[u]; i; i = ed[i].next)
    if (ed[i].t != fa && !vis[ed[i].t]) dfs2(ed[i].t, u);
}
void work(int u) {
  int mx = 0;
  ds[u] = 0;
  for (int i = head[u]; i; i = ed[i].next)
    if (!vis[ed[i].t]) {
      mx2 = 0;
      dfs2(ed[i].t, u);
      for (int i = 1; i <= mx2; i++) s1[i] += s2[i], s3[i] = s2[i], s2[i] = 0;
      int l = 1;
      while (l <= mx2 * 2) l <<= 1;
      for (int i = mx2 + 1; i < l; i++) s3[i] = 0;
      dft(l, s3, 1);
      for (int i = 0; i < l; i++) s3[i] = 1ll * s3[i] * s3[i] % 998244353;
      dft(l, s3, -1);
      for (int i = 0; i < l; i++)
        s4[i] = (s4[i] - s3[i] + 998244353) % 998244353;
      if (mx < mx2) mx = mx2;
    }
  int l = 1;
  while (l <= mx * 2) l <<= 1;
  for (int i = mx + 1; i < l; i++) s1[i] = 0;
  dft(l, s1, 1);
  for (int i = 0; i < l; i++) s1[i] = 1ll * s1[i] * (s1[i] + 2) % 998244353;
  dft(l, s1, -1);
  for (int i = 0; i < l; i++) s4[i] = (s4[i] + s1[i]) % 998244353, s1[i] = 0;
  return;
}
void dfs3(int u) {
  vis[u] = 1;
  work(u);
  for (int i = head[u]; i; i = ed[i].next)
    if (!vis[ed[i].t]) {
      vl = sz[ed[i].t], mx1 = 1e9;
      dfs1(ed[i].t, u);
      dfs3(as);
    }
}
void fz1(int l, int r) {
  if (l >= r) return;
  int mid = (l + r) >> 1;
  int m1 = 0, m2 = 0;
  for (int i = l; i <= mid; i++) m1 = max(len[i] + mid - i, m1);
  for (int i = mid + 1; i <= r; i++) m2 = max(len[i] + i - mid - 1, m2);
  for (int i = 0; i <= m1; i++) s1[i] = 0;
  for (int i = 0; i <= m2; i++) s2[i] = 0;
  for (int i = l; i <= mid; i++)
    for (int j = 0; j <= len[i]; j++) s1[mid - i + j] += sth[j + lb[i]];
  for (int i = mid + 1; i <= r; i++)
    for (int j = 0; j <= len[i]; j++) s2[i - mid - 1 + j] += sth[j + lb[i]];
  int s = 1;
  while (s <= m1 + m2) s <<= 1;
  for (int i = m1 + 1; i < s; i++) s1[i] = 0;
  for (int i = m2 + 1; i < s; i++) s2[i] = 0;
  dft(s, s1, 1);
  dft(s, s2, 1);
  for (int i = 0; i < s; i++) s1[i] = 2ll * s1[i] * s2[i] % 998244353;
  dft(s, s1, -1);
  for (int i = 0; i < s; i++) s4[i + 1] = (s4[i + 1] + s1[i]) % 998244353;
  fz1(l, mid);
  fz1(mid + 1, r);
}
void fz2(int l, int r) {
  if (l >= r) return;
  int mid = (l + r) >> 1;
  int m1 = 0, m2 = 0;
  for (int i = l; i <= mid; i++) m1 = max(len[i] + i - l, m1);
  for (int i = mid + 1; i <= r; i++) m2 = max(len[i] + r - i, m2);
  for (int i = 0; i <= m1; i++) s1[i] = 0;
  for (int i = 0; i <= m2; i++) s2[i] = 0;
  for (int i = l; i <= mid; i++)
    for (int j = 0; j <= len[i]; j++) s1[i - l + j] += sth[j + lb[i]];
  for (int i = mid + 1; i <= r; i++)
    for (int j = 0; j <= len[i]; j++) s2[r - i + j] += sth[j + lb[i]];
  int s = 1;
  while (s <= m1 + m2) s <<= 1;
  for (int i = m1 + 1; i < s; i++) s1[i] = 0;
  for (int i = m2 + 1; i < s; i++) s2[i] = 0;
  dft(s, s1, 1);
  dft(s, s2, 1);
  for (int i = 0; i < s; i++) s1[i] = 2ll * s1[i] * s2[i] % 998244353;
  dft(s, s1, -1);
  for (int i = 0; i < s; i++)
    s4[i + le - r + l] = (s4[i + le - r + l] + s1[i]) % 998244353;
  fz2(l, mid);
  fz2(mid + 1, r);
}
int main() {
  scanf("%d", &n);
  m = n;
  for (int i = 1; i <= m; i++) scanf("%d%d", &a, &b), adde(a + 1, b + 1);
  {
    dfs0(1, 0);
    for (int i = 1; i <= le; i++) {
      vis[c[i == 1 ? le : i - 1]] = 1, vis[c[i == le ? 1 : i + 1]] = 1;
      vis[c[i]] = 0;
      ds[0] = -1;
      mx2 = 0;
      dfs2(c[i], 0);
      lb[i] = ++ct2;
      len[i] = mx2;
      ct2 += mx2;
      for (int j = 0; j <= mx2; j++)
        sth[j + lb[i]] = s2[j], s5[j] += s2[j], s3[j] = s2[j], s2[j] = 0;
      int l = 1;
      while (l <= mx2 * 2) l <<= 1;
      for (int j = mx2 + 1; j < l; j++) s3[j] = 0;
      dft(l, s3, 1);
      for (int j = 0; j < l; j++) s3[j] = 1ll * s3[j] * s3[j] % 998244353;
      dft(l, s3, -1);
      for (int j = 0; j < l; j++)
        s4[j + le - 1] = (s4[j + le - 1] + s3[j]) % 998244353, s3[j] = 0;
      dfs3(c[i]);
    }
    fz1(1, le);
    fz2(1, le);
    int l = 1;
    while (l <= n * 2) l <<= 1;
    dft(l, s5, 1);
    for (int i = 0; i < l; i++) s5[i] = 1ll * s5[i] * s5[i] % 998244353;
    dft(l, s5, -1);
    for (int j = 0; j < l; j++)
      s4[j + le - 1] = (s4[j + le - 1] - s5[j] + 998244353) % 998244353;
    double ans = 0;
    for (int i = 1; i <= n; i++)
      ans = (ans + 1.0 * (s4[i] > 1e7 ? s4[i] - 998244353 : s4[i]) / (i + 1));
    printf("%.10lf\n", ans + n);
  }
}