After a walk a man and his dog return home. Their distance from home is 10 km. The man walks with constant speed of 5 km/h. But the dog runs twice as fast and reaches home at the moment when his master has only done half of the way; immediately the dog runs back to his master, then back home, then aganin back to his master, and so forth.

This back and forth finally stops when the man reaches home. What is the total distance the dog has done?