one day Natalia walk wood meet little mushroom gnome the gnome tell follow storyeverybody know mushroom gnome power lie magic mushroom grow native wood gnome there n tree m magic mushroom wood ith tree grow point straight line coordinate ai height hi jth mushroom grow point coordinate bj magical power zjBut day wild mushroommuncher swear enemy mushroom gnome unleash terrible storm home forest as result tree begin fall crush magic mushroom the supreme oracle mushroom gnome calculate advance probability tree fall leave right stand if tree coordinate x height h fall leave mushroom belong rightopen interval xhx destroy if tree fall right mushroom belong leftopen interval xxh destroy only mushroom hit single tree surviveknowing tree fall independently ie event mutually independent tree interfere tree fall arbitrary direction supreme oracle able quickly calculate expectation total power mushroom survive storm his calculation ultimately save mushroom gnome imminent deathNatalia good Olympiad programmer get interested story decided come way quickly calculate expectation sum survive mushroom power