WA on test #70.
Code for problem 83D.