calculating total compensation