Added solution to UVa 401.