JavaScript code for PE problem 345 added.