#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int infi = INT_MAX;
const long long infll = LLONG_MAX;
const long double PI = 3.1415926535897932384626;
void bad() {
  cout << -1 << '\n';
  exit(0);
}
const int N = 1e5 + 10;
int n, u, v;
vector<int> adj[N];
void read() {
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
}
long double dfs(int node, int parent) {
  long double sum = 0;
  int cnt = 0;
  for (int child : adj[node]) {
    if (child != parent) {
      sum += dfs(child, node) + 1;
      ++cnt;
    }
  }
  if (cnt) {
    sum /= cnt;
  }
  return sum;
}
void solve(int test_case) {
  read();
  cout << setprecision(20) << fixed << dfs(1, 0);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) {
    solve(tc);
  }
  return 0;
}
