#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
double sm = 0;
void dfs(int par, int cur, double prob, int dis) {
  if (g[cur].size() == 1 && g[cur][0] == par)
    sm += prob * dis;
  else {
    int sz = g[cur].size();
    for (int i = 0; i < sz; i++) {
      if (g[cur][i] != par)
        if (cur != 1)
          dfs(cur, g[cur][i], prob * (1.00 / (sz - 1)), dis + 1);
        else
          dfs(cur, g[cur][i], prob * (1.00 / (sz)), dis + 1);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, 1, 1, 0);
  printf("%.7f", sm);
}
