The political life of one country is very lively. The country has & nbsp; k & nbsp; political parties, each of which regularly announces a national strike. The days when at least one of the parties announces the strike, provided that it is not Saturday or Sunday (when no one works), they will cause great damage to the country's economy.
rn
I-I, the batch announces the strikes strictly every b_i & nbsp; days, starting from day with the number & nbsp; a_i . That is, the i-th party announces strikes on the days of & nbsp; a_i , & nbsp; a_i + b_i , & nbsp; a_i + 2 * b_i & nbsp; etc. If on some day several parties declares a strike, then this is considered one nationwide strike.
rn
in the calendar of the country n & nbsp; days numbered, starting with a unit. The first day of the year is Monday, sixth and seventh days of the year & nbsp; & mdash; The weekend, the week consists of seven days.
rn
in the first line of the number given n & nbsp; and & nbsp; k . Next is & NBSP; k & nbsp; lines describing the graphs of the strikes. The I-I line contains the numbers & nbsp; a_i & nbsp; and & nbsp; b_i . You need to determine the number of strikes that have occurred in this country during the year.
Input format
two integers are introduced in the first line: n (number of days a year) and K (number of political parties).
In the following k lines, pairs of integers are introduced by A_I and B_I, where A_I is the day of the start of the II batch strikes, and B_I is the interval between the strikes of the i -th party
Hint
There will be no clue here, decide for yourself!