#include <bits/stdc++.h>
using namespace std;
int n = 0, sum = 0, cnt = 0;
vector<long long int> visited(100007);
vector<vector<long long int>> adj(100007);
long double dfs(int v = 0, int p = -1) {
  long double sum = 0;
  for (auto u : adj[v]) {
    if (u != p) sum += dfs(u, v) + 1;
  }
  return sum ? sum / (adj[v].size() - (p != -1)) : 0;
}
void solve() {
  cin >> n;
  for (long long int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  cout << fixed << setprecision(10) << dfs() << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  tc = 1;
  while (tc--) {
    solve();
  }
  return 0;
}
