Island

아직 제출이 없습니다시간 제한7초메모리 제한512 MB

문제

Welcome to island Bitcairn! We have everything here -- settlements, roads, beautiful lake, the Internet and a monster living in the lake which is ready to destroy the whole island! Wait, wait, wait -- a monster in the lake?!

Byteasar, governor of Bitcairn, has just ordered you to prepare an evacuation plan for tourists in a case of monster's attack. He told you following information about the island:

  • The island can be imagined as a ring whose outer boundary is the boundary of a sea and inner boundary is a boundary of the lake.
  • There are nn settlements numbered with consecutive numbers from 11 to nn.
  • Settlements with numbers from 11 to aa are placed on the boundary of the lake. Moreover they are numbered either clockwise or counterclockwise along that boundary.
  • Settlements with numbers from a+1a+1 to a+ba+b are placed on a coast (boundary of sea). Moreover they are numbered either clockwise or counterclockwise along the coast.
  • There are mm roads connecting settlements. Each of the roads can't pass through neither the lake, the sea nor other settlements. Moreover two roads can intersect in their common endpoint only (if they share one). In other words road network forms a planar graph. Moreover each road can be either directed or undirected.
  • All tourists live in settlements that are placed on the boundary of the lake. It can be assumed that from each of these settlements it is possible to get to the coast using road network (possibly using multiple roads).

In order to enable evacuation, you need to design a plan of building seaports. Such plan should contain subset of coastal settlements where seaports will be built and it ensures safety for all tourists if and only if each tourist living in settlement on the boundary of the lake can reach at least settlements on the boundary of the sea where seaports will be built.

Byteasar would like to know, what is the number of plans ensuring safety? Since the result can be huge, it is sufficient to print it modulo 109+710^9 +7. You need to hurry up -- safety of tourists depends on you!

입력

The first line of input contains four intergers nn, mm, aa and bb (2n500,0002 \le n \le 500\\,000, 1m1,000,0001 \le m \le 1\\,000\\,000, a,b1a, b \ge 1, a+bna + b \le n) denoting number of settlements, number of roads, number of settlements on the boundary of the lake and number of settlements on the boundary of the sea, respectively.

Following mm lines describe roads. Each of them contains a description of one road in the following format:

  • u_iu\_i -{-} v_iv\_i (describing bidirectional road connecting settlements u_iu\_i and v_iv\_i)
  • u_iu\_i -> v_iv\_i (describing unidirectional road going from settlement u_iu\_i to settlement v_iv\_i)

where 1u_i,v_in1 \le u\_i, v\_i \le n and u_iv_iu\_i \neq v\_i.

No two roads connect the same pair of settlements. You can assume that these settlements and roads form a planar graph. Moreover for every settlement on the boundary of the lake at least one settlement on the coast can be reached.

출력

You need to output one integer -- number of plans ensuring safety, modulo 109+710^9+7.

힌트

In the first test we need to build a seaport in a settlement number 66 in order to ensure safety for tourists living in settlement number 33. However, tourists from settlements number 11 and 22 are able to reach it as well, so they safety will be ensured as well in that case, so it doesn't matter whether we build seaports in settlements number 44 and 55.

In the second sample test we need to build seaports in at least two out of settlements in numbers 44, 55 and 66 and that is sufficient to ensure safety of all tourists. It doesn't matter whether we build seaport in settlement number 77. It can be readily checked that in total there are 88 plans ensuring safety.