Tourists were on a hiking trip for three days. On the first day, they hiked 1/8 of the trail. On the second day they hiked 4/7 of the remaining trail. On the third day they hiked1/3 of the remaining trail and the last 8 km. How many km is the whole trail?