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 MAXN = 3000 + 10;
namespace opt {
int N;
const int alp = 999, MOD = 1004535809;
static int a[MAXN], b[MAXN], w[MAXN], tmp[MAXN];
int Pow(int a, int b) {
  int d = 1;
  for (; b; d = (b & 1) ? (long long)d * a % MOD : d,
            a = (long long)a * a % MOD, b /= 2)
    ;
  return d;
}
void FFT(int *a, int S, int d) {
  if (d == N) return;
  FFT(a, S, d << 1);
  FFT(a, S + d, d << 1);
  for (int i = S, j = S, p = 0; i < N / 2; i += d, j += d << 1, p += d) {
    int G = a[j], K = a[j + d];
    tmp[i] = ((long long)G + (long long)w[p] * K) % MOD;
    tmp[i + N / 2] = ((long long)G + (long long)w[p + N / 2] * K) % MOD;
  }
  for (int i = S; i < N; i += d) a[i] = tmp[i];
}
void conv(int *aa, int *bb, int *c, int n) {
  for (int i = 0; i < n; ++i) a[i] = aa[i], b[i] = bb[i];
  if (n <= 5) {
    for (int i = 0; i < n * 2; ++i) c[i] = 0;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) c[i + j] += a[i] * b[j];
    for (int i = 0; i < n; ++i) a[i] = b[i] = 0;
    return;
  }
  N = 1;
  for (; N < n; N <<= 1)
    ;
  N <<= 1;
  w[0] = 1;
  w[1] = alp;
  for (int i = N; i <= (1 << 19); i <<= 1, w[1] = (long long)w[1] * w[1] % MOD)
    ;
  for (int i = 2; i < N; ++i) w[i] = (long long)w[i - 1] * w[1] % MOD;
  FFT(a, 0, 1);
  FFT(b, 0, 1);
  for (int i = 0; i < N; ++i) a[i] = (long long)a[i] * b[i] % MOD;
  for (int i = 0; i < N; ++i) b[i] = a[i ? (N - i) : 0];
  FFT(b, 0, 1);
  int InvN = Pow(N, MOD - 2);
  for (int i = 0; i < N; ++i)
    c[i] = (long long)b[i] * InvN % MOD, a[i] = b[i] = 0;
}
}  // namespace opt
vector<int> L;
struct Graph {
  int id, next;
  bool flag;
} g[MAXN * 2];
int st[MAXN], dep[MAXN], bel[MAXN], n, f[MAXN][MAXN], num[MAXN], fa[MAXN];
bool vis[MAXN];
void Add(int tot, int x, int y) {
  g[tot].id = y, g[tot].next = st[x], st[x] = tot, g[tot].flag = true;
}
bool mark[MAXN];
int head, tail, que[MAXN], size[MAXN], h[MAXN];
void work(int x, int y) {
  for (int i = x; i; i = fa[i]) mark[i] = true;
  for (int i = y; i; i = fa[i]) {
    L.push_back(i);
    if (mark[i]) {
      mark[i] = false;
      break;
    }
  }
  reverse(L.begin(), L.end());
  for (int i = x; mark[i]; i = fa[i]) L.push_back(i);
}
void Find_Loop(int S) {
  head = 0, tail = 1, que[1] = S;
  fa[S] = 0;
  vis[S] = true;
  while (head < tail) {
    int x = que[++head];
    for (int i = st[x]; i != -1; i = g[i].next)
      if (g[i].id != fa[x])
        if (vis[g[i].id]) {
          work(x, g[i].id);
          return;
        } else
          vis[g[i].id] = true, fa[g[i].id] = x, que[++tail] = g[i].id;
  }
}
void init() {
  scanf("%d", &n);
  memset(st, -1, sizeof(st));
  for (int i = 1; i <= n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    ++x, ++y;
    Add(i * 2, x, y);
    Add(i * 2 + 1, y, x);
  }
  Find_Loop(1);
  memset(mark, 0, sizeof(mark));
  for (int i = 0; i < (int)L.size(); ++i) mark[L[i]] = true;
  for (int i = 0; i < (int)L.size(); ++i)
    for (int j = st[L[i]]; j != -1; j = g[j].next)
      if (mark[g[j].id]) g[j].flag = false;
  memset(vis, 0, sizeof(vis));
}
double Tohka;
void BFS(int S) {
  head = 0, tail = 1, que[1] = S;
  dep[S] = 0;
  vis[S] = true;
  while (head < tail) {
    int x = que[++head];
    for (int i = st[x]; i != -1; i = g[i].next)
      if (g[i].flag && !vis[g[i].id])
        vis[g[i].id] = true, dep[g[i].id] = dep[x] + 1, que[++tail] = g[i].id;
  }
  for (int t = tail; t >= 1; --t) {
    int x = que[t];
    vis[x] = false;
    size[x] = 1;
    for (int i = st[x]; i != -1; i = g[i].next)
      if (g[i].flag && !vis[g[i].id]) size[x] += size[g[i].id];
  }
}
int Count(int x, int *f) {
  BFS(x);
  for (int i = 1; i <= tail; ++i) ++f[dep[que[i]]];
  int Tohka = 0;
  while (f[Tohka]) ++Tohka;
  return Tohka;
}
int Find_G(int x) {
  BFS(x);
  for (int t = tail; t >= 1; --t) {
    int x = que[t];
    bool flag = true;
    for (int i = st[x]; i != -1; i = g[i].next)
      if (g[i].flag)
        if (size[g[i].id] < size[x] && size[g[i].id] > tail / 2) flag = false;
    if (flag && tail - size[x] <= tail / 2) return x;
  }
}
int Kurumi;
int cnt[100];
void Calc(int *h, int n, int delta, int p, bool flag) {
  for (int i = 0; i < n; ++i)
    Tohka += (double)p * 1.0 / (i + delta) * h[i] * Kurumi,
        h[i] = (!flag) ? 0 : h[i];
}
void solve(int dep, int x, int n) {
  int G = Find_G(x);
  int len = Count(G, h);
  opt::conv(h, h, h, len);
  Calc(h, len * 2, 1, 1, 0);
  for (int i = st[G]; i != -1; i = g[i].next)
    if (g[i].flag) {
      g[i].flag = g[i ^ 1].flag = false;
      len = Count(g[i].id, h);
      opt::conv(h, h, h, len);
      Calc(h, len * 2, 3, -1, 0);
      solve(dep + 1, g[i].id, size[g[i].id]);
    }
}
void solve() {
  Kurumi = 1;
  for (int i = 0; i < (int)L.size(); ++i) {
    num[i] = Count(L[i], f[i]);
    solve(0, L[i], size[L[i]]);
  }
  Kurumi = 2;
  for (int i = 0; i < (int)L.size(); ++i)
    for (int j = i + 1; j < (int)L.size(); ++j) {
      int y = j - i - 1, z = (i - j + (int)L.size()) - 1;
      opt::conv(f[i], f[j], h, max(num[i], num[j]));
      int len = max(num[i], num[j]) * 2;
      Calc(h, len, y + 2, 1, 1);
      Calc(h, len, z + 2, 1, 1);
      Calc(h, len, y + z + 2, -1, 0);
    }
  printf("%.10lf\n", Tohka);
}
int main() {
  init();
  solve();
  fclose(stdin);
  fclose(stdout);
  return 0;
}