Consider that the balls's velocity of 40 m/s is being sapped away by gravity at a rate of 9.8 m/s/s. How much time (t) will it take for v to be reduced to zero?
What will the ball's average velocity be over time period t? (Now you can solve for h.)
(Also: you probably just made a typo but note that g is an acceleration and as such takes the unit "m/s/s", normally written "m/s2". "m/s" is a unit of velocity, not acceleration.).