Fulano, an avid gamer, has come across an epic challenge in the online game "Boss Challenge". The goal is to defeat a powerful boss, whose power is described by a set of ancient runes. These runes represent a giant binary number $$$N$$$, indicating the total strength of the enemy.
To defeat the boss, Fulano has $$$M$$$ different spells at his disposal, and the goal is to reduce the total strength of the enemy to zero using these spells. The $$$i$$$-th spell is described with two integers $$$a_i$$$ and $$$b_i$$$. When used, the $$$i$$$-th spell reduces the value of $$$N$$$ by $$$a_i$$$ units. This spell can be used as many times as the player wants, as long as two specific conditions are met:
Fulano is fascinated by the game and wants to find out how many different ways he can combine the spells to reduce the binary number $$$N$$$ to exactly zero and thus defeat the boss. Two combinations are considered different if the sequence in which the spells are used is different.
Since the number of possible combinations can be very large, the answer should be given modulo $$$10^9 + 7$$$.
Help Fulano find the answer!
The first line contains two integers, $$$N$$$ $$$(1 \leq N \leq 10^{18})$$$, representing the boss's power, and $$$M$$$ $$$(1 \leq M \leq 10^5)$$$, denoting the number of spells available.
The next $$$M$$$ lines contain the spell descriptions: the $$$i$$$-th of these lines contains two numbers $$$a_i$$$ $$$(1 \leq a_i \leq 100)$$$ and $$$b_i$$$ $$$(0 \leq b_i \leq 60)$$$.
Print a single integer: the number of different sequences of spell uses (taken modulo $$$10^9 + 7$$$) that reduce the boss's power from $$$N$$$ to 0.
6 2 1 0 2 1
8
9 5 1 0 1 1 4 3 1 1 8 0
92