http://www.algorithmist.com/index.php/UVa_10323