"Update optimizing with for loop and modulo operator