#include <bits/stdc++.h>
using namespace std;
class vertex {
 public:
  bool checked = false;
  int distance;
  vector<int> neighbors;
  int possibleChoices;
};
vector<vertex> vertices;
vector<double> ans;
void dfs(int current, int prev, int distance) {
  if (vertices[current].neighbors.size() == 1) {
    ans[current] = 0.0;
    return;
  }
  ans[current] = 0.0;
  for (int i = 0; i < vertices[current].neighbors.size(); i++) {
    if (vertices[current].neighbors[i] != prev) {
      assert(vertices[current].neighbors.size() > 1);
      dfs(vertices[current].neighbors[i], current, distance + 1);
      ans[current] += ans[vertices[current].neighbors[i]];
    }
  }
  ans[current] /= (vertices[current].neighbors.size() - 1);
  ans[current]++;
}
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0.0;
    return 0;
  }
  vertices.resize(n);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    vertices[v].neighbors.push_back(u);
    vertices[u].neighbors.push_back(v);
  }
  ans.resize(n);
  int firstSize = vertices[0].neighbors.size();
  ans[0] = 0.0;
  for (int i = 0; i < firstSize; i++) {
    dfs(vertices[0].neighbors[i], 0, 1);
    ans[0] += ans[vertices[0].neighbors[i]];
  }
  ans[0] /= (double)firstSize;
  ans[0]++;
  cout << fixed << ans[0];
}
