$${W_T = Td\, \cos \phi = m(a + g)d\, \cos \phi}$$