problem 1017