http://uva.onlinejudge.org/external/2/231.html