#include <bits/stdc++.h>
using namespace std;
int hcf(int a, int b) {
  if (!a)
    return (b);
  else
    return (hcf(b % a, a));
}
int lcm(int a, int b) { return ((a * b) / hcf(a, b)); }
long long isP(long long n) {
  if (n == 0 || n == 1) return 0;
  for (long long i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
vector<long long> v[100005];
long double ans = 0.0;
void dfs(long long node, long long parent, long double prob, long long depth) {
  long long below = 0;
  for (long long i : v[node]) {
    if (i != parent) {
      below++;
    }
  }
  for (long long i : v[node]) {
    if (i != parent) {
      dfs(i, node, prob / below, depth + 1);
    }
  }
  if (below == 0) {
    ans += (prob * depth);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 1, 1.0, 0);
  cout << fixed << setprecision(7) << ans << endl;
  return 0;
}
