A Fast Lithographic Mask Correction Algorithm