http://uva.onlinejudge.org/external/104/10405.html