Suppose that $S$ is a finite set of positive integers. If the greatest integer in $S$ is removed from $S$, then the average value (arithmetic mean) of the integers remaining is $32$. If the least integer in $S$ is also removed, then the average value of the integers remaining is $35$. If the greatest integer is then returned to the set, the average value of the integers rises to $40$. The greatest integer in the original set $S$ is $72$ greater than the least integer in $S$. What is the average value of all the integers in the set $S$?