#include <bits/stdc++.h>
using namespace std;
double exp_len;
void myDfs(vector<int>* adj, int* vis, int curr, int dist, double prob) {
  vis[curr] = 1;
  int flag = 0, s = adj[curr].size() - 1;
  if (curr == 0) {
    s++;
  }
  vector<int>::iterator it;
  for (it = adj[curr].begin(); it != adj[curr].end(); it++) {
    if (!vis[*it]) {
      myDfs(adj, vis, *it, dist + 1, prob * (1.0 / s));
      flag++;
    }
  }
  if (!flag) {
    exp_len += (double)prob * dist;
  }
  return;
}
int main(void) {
  int n, u, v, i;
  cin >> n;
  vector<int>* adjL = new vector<int>[n]();
  int* visited = new int[n]();
  for (i = 1; i < n; i++) {
    cin >> u >> v;
    u--;
    v--;
    adjL[u].push_back(v);
    adjL[v].push_back(u);
  }
  exp_len = 0;
  myDfs(adjL, visited, 0, 0, 1.0);
  cout << setprecision(10) << exp_len << endl;
  return 0;
}
