http://uva.onlinejudge.org/external/118/11840.html