This page is still under construction.

Parts of this page are still being built. What you see may change.

Bombs

Time limit3sMemory limit1024 MB

Summary
Given a multigraph with room 0 as the outside, find the fewest days to route k labeled bombs to their target rooms when each door and each bomb allows one crossing per day.
Level

Hard8 of 10

Topics
Graph, BFS, Shortest path, Bit manipulation
Solved
No attempts yet

Problem

Your team has discovered that the fearsome Bureau of Global Overlords (BGO) has devised a plan for world domination. The only way to save the world from certain doom is to blow up the BGO headquarters.

You have kk bombs at your disposal, and an expert has analysed the headquarters' super-intricate floor plan and pointed out the best rooms to place them. The last remaining problem is that the BGO headquarters has a somewhat peculiar surveillance system in their doors; the bombs are just a tiny tad below the threshold for the amount of suspiciousness the door surveillance accepts per day. Hence, each day only a single bomb may pass a given door in the headquarters. Moreover, the surveillance system is based on a type of ultrafancy wave technology that makes the bomb feel quite unwell, so it is only safe to carry a particular bomb through a single door each day as well.

Assuming your stealth skills grant you unlimited access, how many days are required to place the bombs?

Input

The first line contains three space-separated integers, nn, mm and kk. The first integer 1≤n≤1001\leq n \leq 100 denotes the number of rooms in the BGO headquarters; the rooms are labelled with numbers from 11 to nn (inclusive). For simplicity we denote the outside (where all the bombs are initially) as room 00.

The second integer 1≤m≤4001 \leq m \leq 400 denotes the number of doors between rooms in the headquarters. Note that there may be multiple doors between the same rooms, and that some doors may go to the outside. The third integer 1≤k≤81 \leq k \leq 8 denotes the number of bombs.

On the second line follows kk space-separated integers b1,b2,…bkb_1, b_2, \ldots b_k, indicating the rooms where the bombs should be placed (1≤bi≤n1 \leq b_i \leq n for every ii).

Finally follows mm lines, each describing a door. Each such line contains two distinct space-separated integers 0≤u,v≤n0 \leq u, v \leq n indicating that there is a door between room uu and room vv.

Output

Output a single integer, the minimum number of days required to place the bombs.

Examples1

  1. Example 1

    Input
    3 4 5
    2 2 2 3 3
    0 1
    1 2
    2 3
    2 0
    
    Expected output
    3