Math behind Ruzzle