Peter is having lunch at home. Unfortunately for him, today's meal is soup. As Peter's mother knows that he doesn't like it very much, she has prepared a special soup using pasta pieces shaped like letters from the alphabet, numbers, and other characters. She has a special knife with which she can make an unlimited number of pasta pieces in different shapes. The soup always contains pasta pieces, and is so thick that the pieces never move.
Despite her efforts, Peter is still unhappy with today's menu and wonders how many days in his life he will have to eat soup. His mother promises that each day she will prepare a new soup and that no day will have a dish with exactly the same arrangement of shapes as any previous soup served. However, the number of pasta pieces and their floating positions will remain the same every day. Peter is not easily fooled (at least he thinks so), and he cleverly realizes that this can still make him eat soup forever. To reduce the number of configurations, he tells his mother that he will not accept a dish if it can be obtained by rotating one of the previously seen configurations.

Figure 1: Top view of Peter's dish
Consider the dish as a circle of radius centered at the origin. All the symbols float in the soup at a given angle (in millidegrees) at a distance from the origin. Two plates are considered equal if you can rotate one of the dishes about its center so that the positions of the symbols, as well as the symbols themselves, are the same in both dishes.
The first line in each test case contains two numbers: (2 \leq s \leq 1000) — the number of shapes Peter's mother can use, and (p > 0) — the number of pasta pieces floating in the soup. Each of the next lines contains the angle (0 \leq a < 360000) of one of the pieces (measured clockwise in millidegrees). All angles are different.
Test cases are separated by an empty line. After the last test case, there is a line with s = p = -1.
For each test case, print a single integer on a line — the number of different plates Peter's mother can prepare modulo 10^8 + 7.
Örnek 1