JavaScript code for PE problem 412 added.