#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
int N;
double answer = 0;
vector<int> adjacency[MAXN];
void dfs(int current_node, int parent, double probability, int depth) {
  int num_children = 0;
  for (auto i : adjacency[current_node]) {
    if (i != parent) {
      num_children++;
    }
  }
  for (auto i : adjacency[current_node]) {
    if (i != parent) {
      dfs(i, current_node, double(probability / num_children), depth + 1);
    }
  }
  if (num_children == 0) {
    answer += probability * depth;
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adjacency[u].push_back(v);
    adjacency[v].push_back(u);
  }
  dfs(0, 0, 1.0, 0);
  cout << fixed << setprecision(7) << answer << endl;
  return 0;
}
