#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 5;
vector<int> g[N];
long double ans[N];
long double pr[N];
void dfs(int v, int len = 0, int p = -1) {
  if (g[v].size() == 1 && v != 0) ans[len] += pr[v];
  for (auto to : g[v]) {
    if (to != p) {
      pr[to] = pr[v] * (1.0 / (g[v].size() - (v != 0)));
      dfs(to, len + 1, v);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  pr[0] = 1.0;
  dfs(0);
  long double ANS = 0.0;
  for (int i = 1; i < N; ++i) {
    ANS += ans[i] * (long double)i;
  }
  cout << fixed << setprecision(12) << ANS;
  return 0;
}
