spoj problem

17400. Height of Expectation