simplify modulo calculation of first row to calculate