figure out average cost