#include <bits/stdc++.h>
using namespace std;
vector<int> V[100007];
long double expected(int root, int parent = 0) {
  int cnt = V[root].size() - (parent > 0);
  if (cnt == 0) return 0.L;
  long double sum = 0;
  for (auto child : V[root])
    if (child != parent) sum += 1 + expected(child, root);
  return sum / cnt;
}
int main() {
  cin.tie(0), cout.tie(0), ::ios_base::sync_with_stdio(0);
  cout << setprecision(10) << fixed;
  int n, a, b;
  cin >> n;
  for (unsigned i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    V[a].push_back(b);
    V[b].push_back(a);
  }
  cout << expected(1) << '\n';
  return 0;
}
