Correcting UVa 483 solution