In Isart people don't die. There are
n gangs of criminals. The
i-th gang contains
si evil people numerated from
0 to
si-1. Some of these people took part in a big mine robbery and picked
one gold bullion each (these people are given in the input). That happened
10100 years ago and then all of the gangs escaped to a remote area, far from towns.
During the years, they were copying some gold bullions according to an organized plan in order to not get arrested. They constructed a
tournament directed graph (a graph where there is exactly one directed edge between every pair of vertices) of gangs (the graph is given in the input). In this graph an edge from
u to
v means that in the
i-th hour the person
of the gang
u can send a fake gold bullion to person
of gang
v. He sends it if he has some bullion (real or fake), while the receiver doesn't have any. Thus, at any moment each of the gangsters has zero or one gold bullion. Some of them have real bullions, and some of them have fake ones.
In the beginning of this year, the police has finally found the gangs, but they couldn't catch them, as usual. The police decided to open a jewelry store so that the gangsters would sell the bullions. Thus, every gangster that has a bullion (fake or real) will try to sell it. If he has a real gold bullion, he sells it without problems, but if he has a fake one, there is a choice of two events that can happen:
- The person sells the gold bullion successfully.
- The person is arrested by police.
The power of a gang is the number of people in it that successfully sold their bullion. After all selling is done, the police arrests
b gangs out of
top gangs. Sort the gangs by powers, we call the first
a gang
top gangs(you can sort the equal powers in each order). Consider all possible results of selling fake gold bullions and all possible choice of
b gangs among the
top gangs. Count the number of different sets of these
b gangs modulo
109+7. Two sets
X and
Y are considered different if some gang is in
X and isn't in
Y.