You treat an element as A01 and not as 3 seperate characters and apply thew above logic to get the combination.

Say I identify A01 as X A02 as Y .... and then apply the above all combination to XY... and then resubstitute them when needed.