Try using a mod d for Ip