#include <bits/stdc++.h>
using namespace std;
long long modd = 1000000007;
long double dfs(vector<vector<int>>& edges, int index, int prev) {
  int edgeCount = edges[index].size(), i;
  long double ans = 0;
  for (i = 0; i < edgeCount; i++) {
    if (edges[index][i] != prev) {
      ans += 1 + dfs(edges, edges[index][i], index);
    }
  }
  if (ans != 0) {
    if (index == 1) {
      return ans / edgeCount;
    }
    return ans / (edgeCount - 1);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, n, m, i, j, k, a, b;
  cin >> n;
  vector<vector<int>> edges(n + 1, vector<int>());
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    edges[a].emplace_back(b);
    edges[b].emplace_back(a);
  }
  cout << fixed << setprecision(7) << dfs(edges, 1, -1) << "\n";
  return 0;
}
