#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100002];
long double getsum(int cur, int parent) {
  long double sum = 0;
  for (int u : graph[cur]) {
    if (u != parent) {
      sum += getsum(u, cur) + 1;
    }
  }
  if (sum == 0) return sum;
  if (parent == -1) {
    return sum / graph[cur].size();
  } else {
    return sum / ((graph[cur].size()) - 1);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i += 1) {
    int x, y;
    cin >> x >> y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  cout << setprecision(14) << getsum(1, -1) << endl;
  return 0;
}
