You win as soon as cures to all 4 diseases are discovered.

You do NOT have to eradicate all 4 diseases to win; just cure them. Once all the diseases are cured, the game ends and you win immediately, no matter how many cubes remain on the board.

There are 3 ways for the game to end and the players to lose: