adding monte carlo method for calculating pi