Worried Boston Public Library officials didn't have to finish calculating the damage done by this weekend's flood to know the cleanup would be a long and difficult one.

Early Sunday, a ruptured water main sent tens of thousands of gallons gushing into the basement of the nation's oldest public library.The water, from an underground 42-inch iron pipe, surged into the McKim Building, the library's oldest section. More than 50,000 documents were damaged or destroyed, officials said.

As much as 4 feet of water flooded some areas of the marble-tiled subterranean hallways. Water also spilled into the library's main building, leaving about 4 inches of water in basement areas there.

"This is very frustrating," said Mayor Thomas M. Menino, who sur-veyed the damage Sunday. "This is the gem of our library system and the best public research library in the country."