I need help in reversing a formula, and solving L, W and H in reverse

S=L+W2+H2

38= 12.5 + 12.5*2 + .25*2

Where, I tried this, it gave me a good anwser, but I would like to make the results more cube shaped

L=S/W2+H2

If I had a size that is 165, I would like to make, wich is more cube shaped.

L=44, W=40, H=20

Any help would be appreciated, thanks in advance