Fines
Stepan recently purchased a car but hasn't obtained a driver's license yet, which means he's not allowed to drive it. However, his wife has planned a weekend trip that includes a visit to the capital. Without much deliberation, Stepan devised a plan. In his country, traffic police checkpoints are only set up on roads that cannot be bypassed, as this strategy helps catch more violators. There are N cities in Stepan's country, connected by M roads. Importantly, no two roads connect the same pair of cities (smart planning by the authorities). Stepan resides in city A, while the capital is located in city 1. The penalty for driving without a license is 1000 hryvnias.
Your task is to determine how much money Stepan needs to carry to pay all the fines.
Input
The first line contains two integers N and M (2 ≤ N ≤ 10^5, 1 ≤ M ≤ 10^5). The following M lines each contain two integers X_i and Y_i, representing a road between city X_i and city Y_i. The last line contains the integer A (2 ≤ A ≤ N), which is the city where Stepan lives.
Output
Output a single integer on one line—the total amount of hryvnias Stepan should have with him. If reaching the destination is impossible, output -1.