Solved for small case 10^6, not for 10^7
Find patterns, slow
Merge pull request #1 from Meng-Gen/problem-272

Problem 272