Calculating total pay