On four cards, there were four different digits, one of which was zero. Vojta formed the largest four-digit number from the cards, Martin then the smallest four-digit number. Adam wrote the difference between Vojta's and Martin's numbers on the board.

Then Vojta formed the largest three-digit number from the cards, and Martin the smallest three-digit number. Adam again wrote the difference between Vojta's and Martin's numbers on the board. Then Vojta and Martin similarly formed two-digit numbers, and Adam wrote their difference on the board. Finally, Vojta chose the largest one-digit number, and Martin the smallest non-zero one-digit number, and Adam wrote their difference on the board.

When Adam added all four differences on the board, he got 9090. Determine the four digits on the cards.

(L. Růžičková)

Hint. Express the result generally using the unknown digits on the cards.