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 INF = 0x3f3f3f3f;
struct Edge {
  int src, dst, rev;
  int weight;
  Edge(int src, int dst, int weight = 1, int rev = -1)
      : src(src), dst(dst), weight(weight), rev(rev) {}
};
bool operator<(const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight
         : e.src != f.src     ? e.src < f.src
                              : e.dst < f.dst;
}
void addBiEdge(vector<vector<Edge> > &g, int from, int to, int w = 1) {
  while (g.size() < max(from, to) + 1) g.push_back(vector<Edge>());
  g[from].push_back(Edge(from, to, w, g[to].size()));
  g[to].push_back(Edge(to, from, w, g[from].size() - 1));
}
void addEdge(vector<vector<Edge> > &g, int from, int to, int w = 1) {
  while (g.size() < from + 1) g.push_back(vector<Edge>());
  g[from].push_back(Edge(from, to, w));
}
struct IO {
} io;
IO &operator>>(IO &io, int &n) {
  scanf("%d", &n);
  return io;
}
IO &operator>>(IO &io, unsigned int &n) {
  scanf("%u", &n);
  return io;
}
IO &operator>>(IO &io, long long &n) {
  scanf("%lld", &n);
  return io;
}
IO &operator>>(IO &io, unsigned long long &n) {
  scanf("%llu", &n);
  return io;
}
IO &operator>>(IO &io, double &n) {
  scanf("%lf", &n);
  return io;
}
IO &operator>>(IO &io, long double &n) {
  scanf("%Lf", &n);
  return io;
}
IO &operator>>(IO &io, char *c) {
  scanf("%s", c);
  return io;
}
IO &operator<<(IO &io, const int &n) {
  printf("%d", n);
  return io;
}
IO &operator<<(IO &io, const unsigned int &n) {
  printf("%u", n);
  return io;
}
IO &operator<<(IO &io, const long long &n) {
  printf("%lld", n);
  return io;
}
IO &operator<<(IO &io, const unsigned long long &n) {
  printf("%llu", n);
  return io;
}
IO &operator<<(IO &io, const double &n) {
  printf("%lf", n);
  return io;
}
IO &operator<<(IO &io, const long double &n) {
  printf("%Lf", n);
  return io;
}
IO &operator<<(IO &io, const char c[]) {
  printf("%s", c);
  return io;
}
template <class T>
IO &operator>>(IO &io, vector<T> &v) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) {
    T t;
    io >> t;
    v.push_back(t);
  }
}
int n;
vector<vector<Edge> > g;
int parent[3010], dist[3010], cparent[3010], cdist[3010];
int cycle_pos[3010];
bool vis[3010];
vector<int> v[3010];
vector<int> c;
void find_cycle(int u = 0, int d = 0, int p = -1) {
  if (vis[u]) {
    int p0 = p, p1 = parent[u];
    vector<int> c0, c1;
    while (p0 != p1) {
      if (dist[p0] > dist[p1]) {
        c0.push_back(p0);
        p0 = parent[p0];
      } else {
        c1.push_back(p1);
        p1 = parent[p1];
      }
    }
    reverse((c1).begin(), (c1).end());
    c.clear();
    c.push_back(u);
    c.insert(c.end(), (c0).begin(), (c0).end());
    c.push_back(p0);
    c.insert(c.end(), (c1).begin(), (c1).end());
    return;
  }
  vis[u] = true;
  parent[u] = p;
  dist[u] = d;
  for (typeof((g[u]).begin()) e = (g[u]).begin(); e != (g[u]).end(); ++e) {
    if (e->dst == p) continue;
    find_cycle(e->dst, d + 1, u);
  }
}
double ans = 0.0L;
void dfs(int u, int anc, int p = -1, int d = 0) {
  cparent[u] = anc;
  cdist[u] = d;
  for (typeof((g[u]).begin()) e = (g[u]).begin(); e != (g[u]).end(); ++e) {
    if (e->dst == p or cycle_pos[e->dst] >= 0) continue;
    dfs(e->dst, anc, u, d + 1);
  }
}
void dfs2(int u, int anc, int p = -1, int d = 0) {
  ans += 1 / (double)(d + 1);
  for (typeof((g[u]).begin()) e = (g[u]).begin(); e != (g[u]).end(); ++e) {
    if (e->dst == p or (cycle_pos[e->dst] >= 0 and e->dst != anc)) continue;
    dfs2(e->dst, anc, u, d + 1);
  }
}
int main() {
  io >> n;
  g.assign(n, vector<Edge>());
  for (int i = 0; i < (int)(n); ++i) {
    int a, b;
    io >> a >> b;
    addBiEdge(g, a, b);
  }
  memset((vis), 0, sizeof(vis));
  memset((cycle_pos), -1, sizeof(cycle_pos));
  find_cycle();
  for (int i = 0; i < (int)(c.size()); ++i) cycle_pos[c[i]] = i;
  for (int i = 0; i < (int)(c.size()); ++i) dfs(c[i], c[i]);
  for (int u = 0; u < (int)(n); ++u) {
    int u0 = cparent[u];
    for (int v = 0; v < (int)(n); ++v) {
      int v0 = cparent[v];
      if (u0 == v0) continue;
      int A = abs(cycle_pos[u0] - cycle_pos[v0]), B = c.size() - A;
      A--;
      B--;
      int s = cdist[u] + cdist[v] + c.size();
      ans += 1 / (double)(s - A) + 1 / (double)(s - B) - 1 / (double)s;
    }
  }
  for (int u = 0; u < (int)(n); ++u) dfs2(u, cparent[u]);
  printf("%.10lf\n", ans);
}