Problem 79: largely simplified