#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 5;
long long inf = 1e15;
vector<int> ar[sz];
double ans;
void dfs(int u, int p, double pr, double lev) {
  if (ar[u].size() == 1) {
    ans += (pr * lev);
  }
  for (int v : ar[u]) {
    if (v != p) {
      double val = ar[u].size();
      if (p != 0) val--;
      dfs(v, u, pr * (1 / (val)), lev + 1);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    if (n == 1) {
      cout << 0 << "\n";
      return 0;
    }
    for (int i = 0; i < n - 1; i++) {
      int u, v;
      cin >> u >> v;
      ar[u].push_back(v);
      ar[v].push_back(u);
    }
    dfs(1, 0, 1, 0);
    cout << fixed << setprecision(10) << ans << "\n";
  }
  return 0;
}
