problem 1047