A rake is leaning against a wall. The top of the rake hits the wall 40 inches above the ground and the bottom of the rake is 30 inches away from the base of the wall. A beetle crawls from the bottom of the rake to the top of the rake. Then the beetle climbs down to the base of the wall and back to the bottom of the rake. How far does the beetle travel in all?