#include <bits/stdc++.h>
using namespace std;
const char NL = '\n';
clock_t startTime;
double getCurrentTime() {
  return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
void readarray(vector<long long int> &a) {
  for (auto &it : a) cin >> it;
}
vector<set<long long int>> g(100002);
vector<bool> vis(100002, 0);
long double dfs(long long int root, long long int p) {
  vis[root] = 1;
  long double sum = 0;
  for (long long int i : g[root])
    if (!vis[i]) sum += dfs(i, root) + 1;
  if (sum == 0) return 0;
  return sum / ((long long int)g[root].size() - (p >= 1));
}
void solve() {
  long long int n;
  scanf("%lld", &n);
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    scanf("%lld%lld", &x, &y);
    g[x].insert(y);
    g[y].insert(x);
  }
  long double rs = dfs(1, 0);
  printf("%.18LF\n", rs);
}
int32_t main() {
  startTime = clock();
  solve();
  return 0;
}
