poj solutions in javascript