#include <bits/stdc++.h>
using namespace std;
class Graph {
 public:
  list<int> *adj;
  Graph(int s) { adj = new list<int>[s + 1]; }
  ~Graph() { delete[] adj; }
  void insertEdge(int v, int w) {
    adj[v].push_back(w);
    adj[w].push_back(v);
  }
  double solve(int u, int p) {
    int deg = int(adj[u].size()) - 1;
    if (u == 1) deg++;
    double prob = 1.0 / deg, E = 0;
    for (int v : adj[u]) {
      if (v == p) continue;
      E += prob * (1 + solve(v, u));
    }
    return E;
  }
};
int main() {
  int n;
  cin >> n;
  Graph g(n);
  int v, w;
  for (int i = 0, _ = n - 1; i < _; i++) {
    cin >> v >> w;
    g.insertEdge(v, w);
  }
  cout << fixed << setprecision(13) << g.solve(1, -1) << endl;
  return 0;
}
