up to problem 40