This is a momentum problem, and normally momentum is measured in kg * m/s which are metric units. I'll give an answer in both customary & metric units.
Weight * velocity of train 1 + weight * velocity of train 2 = weight on both trains * new velocity
20,000 * 5 + 40,000 * 7.81 = 100,000 + 312,400 = 412,400 = 60,000 * new velocity
New velocity = 412,400/60,000 = 6.873 feet per second = 82.48 inches per second = 2.09 meters/sec