#include <bits/stdc++.h>
using namespace std;
vector<int> vec[100005];
int judge[100005];
double dfs(int x) {
  judge[x] = 1;
  double sum = 0;
  int all = 0;
  for (int a = 0; a < vec[x].size(); a++) {
    if (!judge[vec[x][a]]) all++;
  }
  if (all == 0) return 0;
  double temp = 1.0 / all;
  for (int a = 0; a < vec[x].size(); a++) {
    int tt = vec[x][a];
    if (!judge[tt]) {
      sum += temp * (1 + dfs(tt));
    }
  }
  return sum;
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int a = 1; a <= n; a++) vec[a].clear();
    for (int a = 1; a < n; a++) {
      int x, y;
      scanf("%d%d", &x, &y);
      vec[x].push_back(y);
      vec[y].push_back(x);
    }
    memset(judge, 0, sizeof(judge));
    printf("%.15f\n", dfs(1));
  }
  return 0;
}
