#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int ff = 0x3f3f3f3f;
vector<int> r[maxn];
int vis[maxn];
int n;
double sum;
void dfs(int x, int step, double p) {
  int k = r[x].size();
  if (k == 1 && x != 1) {
    sum += step * 1.0 * p;
    return;
  }
  for (int i = 0; i < k; i++) {
    if (vis[r[x][i]]) continue;
    vis[r[x][i]] = 1;
    if (x == 1)
      dfs(r[x][i], step + 1, p * (1.0 / k));
    else
      dfs(r[x][i], step + 1, p * (1.0 / (k - 1)));
  }
  return;
}
int main() {
  memset(vis, 0, sizeof(vis));
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    r[a].push_back(b);
    r[b].push_back(a);
  }
  vis[1] = 1;
  dfs(1, 0, 1.0);
  if (n == 1)
    printf("0.000000000000000000000\n");
  else
    printf("%.10f\n", sum);
  return 0;
}
