#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n;
double ans;
struct E {
  int v, nxt;
} e[2 * maxn];
int cnt, h[maxn];
void init() {
  cnt = 0;
  memset(h, -1, sizeof(h));
}
void add(int u, int v) {
  e[cnt].v = v;
  e[cnt].nxt = h[u];
  h[u] = cnt++;
}
void dfs(int pos, int pre, double len, double sum) {
  int all = 0;
  for (int k = h[pos]; ~k; k = e[k].nxt) {
    int v = e[k].v;
    if (v == pre) continue;
    all++;
  }
  if (all == 0) {
    ans += len * sum;
    return;
  }
  for (int k = h[pos]; ~k; k = e[k].nxt) {
    int v = e[k].v;
    if (v == pre) continue;
    dfs(v, pos, len + 1, sum / all);
  }
}
int main() {
  while (scanf("%d", &n) != EOF) {
    int u, v;
    ans = 0;
    init();
    for (int i = 1; i < n; i++) {
      scanf("%d%d", &u, &v);
      add(u, v);
      add(v, u);
    }
    dfs(1, 0, 0, 1.0);
    printf("%.10lf\n", ans);
  }
  return 0;
}
