Let b be the height of the building, and y the height of the ball at time t, given by
y = b - 1/2 gt²
where g = 9.8 m/s² is the magnitude of the acceleration due to gravity.
It takes the ball 8 s to reach the ground, at which point y = 0, so that
0 = b - 1/2 (9.8 m/s²) (8 s)²
b = 1/2 (9.8 m/s²) (8 s)²
b = 313.6 m