(n,),*v = $<.map{|l|l.split.map &:to_i}
path = Hash[(1..n).map{|i|[i,[]]}]
v.each{|s,t|
  path[s]+=[t]
}
through = Hash.new(0.0)
through[1] = 1.0
(1..n-1).each{|i|
  th = through[i]/path[i].size
  path[i].each{|j|
    through[j] += th
  }
}
dp_all = {n=>0.0}
dp_del = {n=>0.0}
(1..n-1).reverse_each{|i|
  nextpath = path[i].map{|t|dp_all[t]}
  sum = nextpath.inject(:+)
  dp_del[i] = dp_all[i] = sum/nextpath.size + 1
  if nextpath.size > 1
  	dp_del[i] = (sum - nextpath.max)/(nextpath.size - 1) + 1
  end
}
ans = dp_all[1] - (1..n-1).map{|i|(dp_all[i]-dp_del[i])*through[i]}.max
p ans