#include <bits/stdc++.h>
using namespace std;
#define sc(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d%d",&x,&y)
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fr(k,n) for(int i=k;i<n;i++)
#define ll long long int
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
struct node{
double prob,len;
int chld,prnt;
node(){
prob=1;len=0;
chld=0;prnt=1;
}
};
vector <pair <int,int> > v;
int n;
struct node rd[100005];
int main(){
sc(n);
int s,t;
fr(1,n){
sc2(s,t);
v.pb(mp(min(s,t),max(s,t)));
}
sort(v.begin(), v.end());
fr(0,n-1){
s=v[i].fi;
t=v[i].se;
rd[s].chld++;
rd[t].prnt=s;
rd[t].len=rd[s].len+1;
}
fr(2,n+1){
rd[i].prob=(rd[rd[i].prnt].prob / (rd[rd[i].prnt].chld));
}
double ans=0;
fr(1,n+1){
if(rd[i].chld==0) ans+=(rd[i].prob*rd[i].len);
}
printf("%0.8lf\n",ans);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7IAoKI2RlZmluZSBzYyh4KSBzY2FuZigiJWQiLCZ4KQojZGVmaW5lIHNjMih4LHkpIHNjYW5mKCIlZCVkIiwmeCwmeSkKI2RlZmluZSBzYzMoeCx5LHopIHNjYW5mKCIlZCVkJWQiLCZ4LCZ5LCZ6KQojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgc2Ugc2Vjb25kCiNkZWZpbmUgcGIoeCkgcHVzaF9iYWNrKHgpCiNkZWZpbmUgbXAoeCx5KSBtYWtlX3BhaXIoeCx5KQojZGVmaW5lIGZyKGssbikgZm9yKGludCBpPWs7aTxuO2krKykKI2RlZmluZSBsbCBsb25nIGxvbmcgaW50CiNkZWZpbmUgXyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKT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