Added UVa #10377's solution