input test case
first attempt: wrong answer...
poj 1009 accepted