We have a grid with n rows and 7 columns. We call it a calendar. The cell at i-th row and j-th column is denoted (i, j).
Initially, each cell at (i, j) contains the integer 7i + j - 8, and each cell is white.
Snuke likes painting, so he decided integer m, and did q operations with a calendar.
・In i-th operation, he paint black on the cell in which an integer is written such remainder of dividing by m is a_i.
Please count the number of connected white parts.
Note that if two adjacent cells are white, the cells belong to the same connected part.