There is one bee that moves along line segments on an imaginary path. Initially located at the origin (0,0), the bee moves northeast along the line y=x until it reaches the next intersection with the polar curve r=cosθ, at which point it starts to move south to the point (21,−21). Finally, the bee returns to the origin along a line segment. What is the total distance traveled by the bee?