1640 FOR M=K TO IP