Solved UVa 446.
Solved UVa 11185.