Tentativa 1: TLE
URI 1107 -> UVa 11683 -> SPOJ BR 5484 resolvido