POJ#1922 Simple math + greedy. RANK 18868