poj problem id 3865 version 2