Diophantus of Alexandria was a Greek mathematician who lived in the third century (AD). Diophantus wrote a series of books called "Arithmetica", most of which are lost. Among many other problems, the Arithmetica contained the following mathematical puzzle:
A man bought several liters of two kinds of wines. He paid 8 drachmas per liter of fine wine and 5 drachmas per liter of ordinary wine. The total sum of money he paid is equal to the square of the total quantity of the bought wine expressed in liters. The task is to find the quantities of each kind of wine.
In solving this puzzle, assume that the man bought (non-negative) integer numbers of liters of both types of wine. The puzzle allows more than one solution, and your task is to determine all solutions.