i was working on a differential equation to find the initial velocity of a rocket to get to height h.

so i have, which i got and its correct cause its the solution in the book, v^2 = 2g(R/(R+h))-2gR+V(0)^2

v = velocity

g = acceleration of gravity at earths surface

R= radius of earth

h = height

and i assume v(0) is the velocity v at height=0 so v(0)=0?

Problem is when i keep getting a negative number. so i assume I'm making an amateur mistake.

What am i doing wrong? ive tried converting etc. im using km