{"problem":{"name":"Calendar 2","description":{"content":"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)$.   ![image](https://atcoder.jp/img/s8pc-4/1bef402eeaddb846eb2ea4d38","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"s8pc_4_c"},"statements":[{"statement_type":"Markdown","content":"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)$.  \n\n![image](https://atcoder.jp/img/s8pc-4/1bef402eeaddb846eb2ea4d386a1ed3d.png)\n\nInitially, each cell at $(i, j)$ contains the integer $7i + j - 8$, and each cell is white.  \n  \nSnuke likes painting, so he decided integer $m$, and did $q$ operations with a calendar.  \n・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$.  \n  \nPlease count the number of connected white parts.  \nNote that if two adjacent cells are white, the cells belong to the same connected part.\n\n## Input Format\n\nThe input format is following:  \n\n$n$ $m$ $q$\n$a_1$ $a_2$ ... $a_q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"s8pc_4_c","tags":[],"sample_group":[],"created_at":"2026-03-03 11:01:14"}}