JavaScript code for PE problem 227 added.