Modified CalculatePi