#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> g[n];
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  double ans = 0;
  function<void(int, int, int, double)> dfs;
  dfs = [&](int u, int pre, int l, double p) {
    int sz = g[u].size();
    if (u) {
      --sz;
    }
    if (!sz) {
      ans += (double)l * p;
      return;
    }
    for (auto v : g[u]) {
      if (v != pre) {
        dfs(v, u, l + 1, p / double(sz));
      }
    }
  };
  dfs(0, 0, 0, 1);
  cout << fixed << setprecision(15) << ans << '\n';
  return 0;
}
