Reverse a Road II

Each directed road carries at most one truck; find whether reversing one road increases the max number of edge-disjoint S-to-T paths, the new maximum, and how many roads achieve it.

Hard9GraphBFSShortest pathImplementationNo attempts yetTime limit8sMemory limit512 MB

Problem

JAG Kingdom has NN cities, numbered 1 through NN, and every road between them is one way. ICPC (International Characteristic Product Corporation) ships products every day from its factory in city SS to its storehouse in city TT. Several trucks run at the same time. Each truck starts at SS, follows one way roads, and reaches TT, passing through other cities on the way or going there directly. To reduce the risk of traffic jams and accidents, no two trucks use the same road.

ICPC already runs as many trucks as that rule allows, and it wants the daily transport to be more efficient. JAG Kingdom, whose finances depend heavily on ICPC, is considering a change of direction of one one way road so that more trucks can run. Reversing many roads causes confusion, so the kingdom reverses at most one road.

If no single reversal raises the number of trucks, the kingdom leaves every road as it is. Decide whether reversing one road raises the current maximum number of trucks. If it does, compute the maximum number of trucks that take pairwise disjoint sets of roads when one road may be reversed, and the number of roads that can be chosen as the road to reverse to reach that maximum.

Input

The input holds several datasets. The number of datasets is at most 100.

Each dataset has the following format.

N M S T
a1 b1
a2 b2
:
:
aM bM

The first line of a dataset holds four integers: the number of cities NN (2N10002 \le N \le 1000), the number of roads MM (1M100001 \le M \le 10000), the city with the factory SS, and the city with the storehouse TT (1S,TN1 \le S, T \le N, STS \ne T).

The next MM lines describe the roads. The ii-th of those lines holds two integers aia_i and bib_i (1ai,biN1 \le a_i, b_i \le N, aibia_i \ne b_i), meaning that road ii is directed from aia_i to bib_i. Several roads may connect the same pair of cities, and each road counts separately.

The end of the input is a line holding four zeros.

Output

For each dataset, print two integers separated by one space on a single line. If reversing one road raises the current maximum number of trucks, the first integer is the new maximum after the reversal and the second integer is the number of roads that can be chosen as the road to reverse to reach that new maximum. Otherwise, the first integer is the current maximum and the second integer is 0.