WA on test #3.
RTE on test #20.
Code for problem 40E.