#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238L;
vector<int> N[100005];
bool memo[100005];
double res = 0;
void dfs(int idx, double p, int depth) {
  if (memo[idx]) return;
  memo[idx] = true;
  int n = N[idx].size();
  if (n == 1 && idx != 0) {
    res += p * (double)depth;
  }
  p = p / (double)(n - (idx != 0));
  depth++;
  for (int i = 0; i < n; i++) {
    dfs(N[idx][i], p, depth);
  }
}
void addE(int a, int b) {
  a--;
  b--;
  N[a].push_back(b);
  N[b].push_back(a);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n;
  while (--n) {
    cin >> a >> b;
    addE(a, b);
  }
  dfs(0, 1, 0);
  cout << fixed << setprecision(12) << res << endl;
  return 0;
}
