#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 100000;
int n;
double ans = 0.0;
vector<int> adj[MAXN];
void dfs(int node, int par, double pro, int d) {
  int children = 0;
  for (int child : adj[node]) {
    if (child != par) {
      children++;
    }
  }
  for (int child : adj[node]) {
    if (child != par) {
      dfs(child, node, pro / children, d + 1);
    }
  }
  if (children == 0) {
    ans += pro * d;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(0, 0, 1.0, 0);
  cout << fixed << setprecision(7) << ans << endl;
}
