Paper 1 October/November 2004 Physics (9702) A Level

A weight W hangs from a trolley that runs along a rail. The trolley moves horizontally through a distance p and simultaneously raises the weight through a height q. As a result, the weight moves through a distance r from X to Y. It starts and finishes at rest. How much work is done on the weight during this process?