Let the length of the train be L and its speed be v. From the first two conditions, we have L equals 12 times v and L plus x equals 36 times v. This gives x equals 36 times v minus 12 times v, so x equals 24 times v. When the train crosses the man running in the opposite direction at 20 kmph, the relative speed is v plus 20. Converting 20 kmph to m/s gives 50 by 9 m/s, so the relative speed is v plus 50 by 9. The crossing equation is L equals 9 times the relative speed, giving 12 times v equals 9 times v plus 50. This simplifies to 3 times v equals 50, meaning v equals 50 by 3 m/s. Substituting this back into the equation for x gives x equals 24 times 50 by 3, resulting in 400. The value of x is 400.