In Castroville, the library is 21 kilometers south of the courthouse and 20 kilometers west of the community swimming pool. If a bird flew directly from the courthouse to the library, then from the library to the swimming pool, and then from the swimming pool back to the courthouse, what would be the total distance flown?