#include <bits/stdc++.h>
using namespace std;
struct node {
  int to, next;
};
node e[200005];
int n, cnt = 0;
int head[200005], vis[200005], d[200005], in[200005];
int b[200005];
long long sum[200005];
void add(int u, int v) {
  e[++cnt].to = v;
  e[cnt].next = head[u];
  head[u] = cnt;
}
void dfs(int u) {
  if (sum[u] > 1e15) return;
  for (int i = head[u]; i; i = e[i].next) {
    if (!vis[e[i].to]) in[u]++;
  }
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (!vis[v]) {
      d[v] = d[u] + 1;
      vis[v] = 1;
      sum[v] = sum[u] * in[u];
      dfs(v);
    }
  }
}
int main() {
  cin >> n;
  sum[1] = 1;
  d[1] = 0;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      vis[i] = 1;
      dfs(i);
    }
  }
  double ans = 0.0, w = 1.0;
  for (int i = 1; i <= n; i++) {
    if (!in[i] && sum[i] != 0) ans += (w * d[i] / sum[i]);
  }
  printf("%.15lf\n", ans);
}
