The U.S. has a treasure trove of historic sites to visit, but geography makes it nearly impossible to visit them all in one trip—or does it? Led by University of Waterloo professor William Cook, a team of researchers used Google Maps and the famous “traveling salesman" mathematics problem to figure out the shortest route to see every single site on the U.S. National Register of Historic Places, as Travel + Leisure reports.

The trip covers more than 217,605 miles and includes more than 49,600 sites, ending back at the original starting point. To put that into context: the distance from Earth to the Moon is 238,900 miles.

Even with hundreds of University of Waterloo computers working on the problem, solving it took four international researchers two years. It began with computing a test problem that calculated the shortest distance between more than 24,700 pubs in the UK. Once that was solved, it took the computers a combined total of 178.9 hours (adding all the computers’ hourly contributions together). Ideally, you would start in Birmingham, Alabama at the A.G. Gaston Building, a landmark of modern architectural design developed by its namesake African-American entrepreneur, and travel the country before ending up back in Alabama at the 16th Street Baptist Church, famous for serving as the headquarters of civil rights meetings in the 1960s.

If you don’t have enough time to visit every single historic building, home, landmark, and monument on the list, the researchers did put together region-specific versions of the tour, too.

[h/t Travel + Leisure]

All images courtesy William Cook.