(n,),*v = $<.map{|l|l.split.map &:to_i}
path = v.inject({}){|h,(s,t)|h.merge({s=>[t]}){|k,v1,v2|v1+v2}}
ans = 1e9
(1..n).each{|bl|
  dp = {n=>0.0}
  (n-1).downto(1){|i|
    nextpath = path[i].map{|t|dp[t]}.sort
    nextpath.pop if i==bl && nextpath[1]
	dp[i] = nextpath.inject(:+)/nextpath.size + 1
  }
  ans = [ans,dp[1]].min
}
p ans
