Raghav took a bus from home to market, that travels at 40 kmph. While walking back at 4 kmph,halfway through, he suddenly realized he was getting late and he cycled back the remaining distance at 30 kmph. Find the average speed.