Leha and Function

CodeForces - 840A