How to calculate the average price of stock

How do investors average stock prices when buying in multiple lots?