Gates is a super rich man . Because of the influence of COVID-19 , he had to do enough protection .To keep himself away from the virus , he formulated strict protective measures .v may contact with each other , if one of them is infected with the virus , then the other one has. n1 edges from a tree , Gates is the root .The level of a person is defined as the depth of him on the tree .probability of infecting the virus from the outside world .We define the disaster value as the lowest level of the person who infected of the virus . .Now please help Gates to calculate what's the expectation of the disaster value ?
Gates is a super rich man . Because of the influence of COVID-19 , he had to do enough protection . To keep himself away from the virus , he formulated strict protective measures . Gates has exactly n-1 n−1 servants , he numbers them 2 2 to n n (Gates is number 1 1) , and n-1 n−1 edges (u,v,a,b) (u,v,a,b) satisfies that u u and v v may contact with each other , if one of them is infected with the virus , then the other one has frac {a}{b} b a probability of being infected . We promise that the n-1 n−1 edges from a tree , Gates is the root . The level of a person is defined as the depth of him on the tree (Gates's level is always 1) . Now we know for the i-th i−th person , he has frac {p_i}{q_i} q i p i probability of infecting the virus from the outside world (At the beginning) . We define the disaster value as the lowest level of the person who infected of the virus . ( If there are no one infected , the disaster value is 0 ) . Now please help Gates to calculate what's the expectation of the disaster value ?