Convert several pattern to magic pattern