Initial version - WA on test #27.
Code for problem 386C.