UVa 674 resolvido