Initial version: WA on test #11.
Second version - WA on test #5.
Code for problem 337E.