A railway wagon of mass 12 tonnes moving freely at 4m/s collides with an empty stationary wagon of mass 4 tonnes at the base of a slope inclined at an angle Ѳ to the horizontal of sinѲ=1/50. The wagons move up the slope together against a constant frictional resistance of 50N per tonne. Calculate the distance they travel up the slope before coming to instantaneous rest.

any help would be great

thanks