#include
using namespace std;
#define float_t __float_t
typedef double float_t; #define _f (float_t)
struct cplx { float_t r, i; cplx() {} cplx(float_t ro, float_t io) { r = ro, i = io; } }; inline cplx operator +(const cplx& a, const cplx& b) { return cplx(a. r + b. r, a. i + b. i); } inline cplx operator -(const cplx& a, const cplx& b) { return cplx(a. r - b. r, a. i - b. i); } inline cplx operator *(const cplx& a, const cplx& b) { return cplx(a. r * b. r - a. i * b. i, a. r * b. i + a. i * b. r); }
const cplx cplx_zero = cplx(0, 0);
struct edge { int t; edge *ne; };
const int maxn = 40003; const int maxl = 17; const float_t pi = acos(-1);
int n, vis[maxn], tvis, dv[maxn], dc[maxn], dt[maxn]; float_t ans; cplx wo[maxl], a[maxn], b[maxn], c[maxn]; edge ebuf_arr[maxn « 1], *ebuf(ebuf_arr), *head[maxn];
void pre() { for (int i = 0; i < maxl; ++ i) { float_t tht(pi * 2 / (1 « i)); wo[i] = cplx(cos(tht), sin(tht)); } }
inline void addEdge(int u, int v) { ebuf-> t = v; ebuf-> ne = head[u]; head[u] = ebuf ++; }
int findGrvCtr(int po) { static int q[maxn], fr[maxn], sz[maxn]; int hd(0), tl(1); fr[q[hd] = po] = 0; while (hd < tl) { int p(q[hd ++]); for (edge* e = head[p]; e; e = e-> ne) if (e-> t != fr[p] && !dv[e-> t]) { fr[e-> t] = p; q[tl ++] = e-> t; } } int sp(po), ss(tl); for (int i = tl - 1; i >= 0; – i) { int p(q[i]), m(0); sz[p] = 1; for (edge* e = head[p]; e; e = e-> ne) if (e-> t != fr[p] && !dv[e-> t]) { sz[p] += sz[e-> t]; if (sz[e-> t] > m) m = sz[e-> t]; } if (tl - sz[p] > m) m = tl - sz[p]; if (m < ss) sp = p, ss = m; } return sp; }
int depthBFS(int po) { static int q[maxn], fr[maxn], d[maxn]; int hd(0), tl(1), t(0); fr[q[hd] = po] = 0; d[po] = 1; dt[0] = 0; while (hd < tl) { int p(q[hd ++]); if (d[p] >= t) dt[d[p]] = 1, t = d[p] + 1; else ++ dt[d[p]]; for (edge* e = head[p]; e; e = e-> ne) if (e-> t != fr[p] && !dv[e-> t]) { fr[e-> t] = p; d[e-> t] = d[p] + 1; q[tl ++] = e-> t; } } return t; }
void fft(cplx* a, int n, int rv) { for (int i = 1, j = n » 1, k; i + 1 < n; ++ i) { if (i < j) swap(a[i], a[j]); for (k = n » 1; j >= k; k »= 1) j -= k; if (j < k) j += k; } for (int h = 2, c = 1; h <= n; ++ c, h «= 1) { cplx w0(wo[c]); if (rv) w0. i = -w0. i; for (int i = 0; i < n; i += h) { cplx w(cplx(1, 0)); for (int j = i; j < i + (h » 1); ++ j) { cplx x(a[j]), y(a[j + (h » 1)] * w); a[j] = x + y; a[j + (h » 1)] = x - y; w = w * w0; } } } if (rv) for (int i = 0; i < n; ++ i) a[i]. r /= n; }
void upAns(int la, int lb) { int m; for (m = 1; m < la + lb; m «= 1); for (int i = 0; i < la; ++ i) a[i] = cplx(dc[i], 0); for (int i = la; i < m; ++ i) a[i] = cplx_zero; fft(a, m, 0); for (int i = 0; i < lb; ++ i) b[i] = cplx(dt[i], 0); for (int i = lb; i < m; ++ i) b[i] = cplx_zero; fft(b, m, 0); for (int i = 0; i < m; ++ i) c[i] = a[i] * b[i]; fft(c, m, 1); for (int i = 0; i < m; ++ i) ans += c[i]. r * 2 / (i + 1); }
void divide(int po) { int p(findGrvCtr(po)), lc(1); dv[p] = 1; dc[0] = 1; for (edge* e = head[p]; e; e = e-> ne) if (!dv[e-> t]) { int lt(depthBFS(e-> t)); upAns(lc, lt); for (int i = 0; i < lc && i < lt; ++ i) dc[i] += dt[i]; if (lc < lt) { for (int i = lc; i < lt; ++ i) dc[i] = dt[i]; lc = lt; } } for (edge* e = head[p]; e; e = e-> ne) if (!dv[e-> t]) divide(e-> t); }
int main() { #ifdef LAEKOV_LOCAL freopen(".in", “r”, stdin); #endif
pre();
scanf("%d", &n);
memset(head, 0, sizeof(head));
for (int i = 1; i < n; ++ i) {
int u, v;
scanf("%d%d", &u, &v);
++ u, ++ v;
addEdge(u, v);
addEdge(v, u);
}
memset(dv, 0, sizeof(dv));
divide(1);
ans += n;
printf("%.4lf\n", (double)ans + 1e-11);
}