added P1,P2 calculation
added P1,P2 calculation