Improved cal3xxx.hs algorithm for concatenation.