First iteration for the grains exercice