A car traveled 75% of the way from town A to town B at an average speed of 50 kmph. The car travels at an average speed of S kmph for the remaining part of the trip. The average speed for the entire trip was 40 kmph. What is S?,