A ball of mass m and another ball of mass 3m are placed inside a smooth metal tube with a massless spring compressed between them. When the spring is released, the heavier ball flies out of one end of the tube with speed v0.