#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
double dfs(int i, int ult) {
  double ans = 0;
  int c = g[i].size() - (i != 1);
  for (int j = 0; j < g[i].size(); j++) {
    if (g[i][j] != ult) {
      ans += (dfs(g[i][j], i) + 1.0) / c;
    }
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  printf("%.15lf\n", dfs(1, 0));
}
