Solved problem 30 with some dirtiness
(where does "1000000" come from ? :p )