_,A,b=$<.map{|e|e.split.map(&:to_i)} q=A.permutation p q.count{|a|s=0;a.zip(b){|x,y|s+=x<=>y};s>0}/q.size.to_f