#include <bits/stdc++.h>
using namespace std;
int n, a, b;
vector<int> G[1000007];
int odw[1000007];
long double ans;
void dfs(int x, long double p, int d) {
  if (odw[x]) return;
  odw[x]++;
  if (G[x].size() == 1 && x != 1)
    ans += p * (long double)d;
  else if (x != 1)
    p /= (long double)(G[x].size() - 1);
  else
    p /= (long double)(G[1].size());
  for (int i = 0; i < G[x].size(); i++) dfs(G[x][i], p, d + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(1, 1, 0);
  cout << setprecision(7) << ans;
  return 0;
}
