$${W_g = mgd\, \cos \phi}$$