#include <bits/stdc++.h>
using namespace std;
const long long maxx = 1e5 + 10;
vector<long long> adj[maxx + 5];
bool used[maxx + 5];
long double lvl[maxx + 5];
long long path = 0;
void dfs(int u) {
  if (u != 1 && adj[u].size() == 1) {
    lvl[u] = 0.0;
    return;
  }
  used[u] = true;
  long double ans = 0.0;
  for (auto v : adj[u]) {
    if (!used[v]) {
      dfs(v);
      ans += lvl[v];
    }
  }
  long double sum;
  int com = adj[u].size() - (u != 1);
  sum = (long double)ans / com + 1.0;
  lvl[u] = sum;
}
int main() {
  long long nodes;
  cin >> nodes;
  for (int i = 1; i < nodes; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (nodes == 1) {
    cout << "0.0" << endl;
    return 0;
  }
  dfs(1);
  long double ans = lvl[1];
  printf("%.15Lf\n", ans);
  return 0;
}
