Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. Pilgrims

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA long time ago there was a land called Dudeland. Dudeland consisted of *n* towns connected with *n* - 1 bidirectonal roads. The towns are indexed from 1 to *n* and one can reach any city from any other city if he moves along the roads of the country. There are *m* monasteries in Dudeland located in *m* different towns. In each monastery lives a pilgrim.

At the beginning of the year, each pilgrim writes down which monastery is the farthest from the monastery he is living in. If there is more than one farthest monastery, he lists all of them. On the Big Lebowski day each pilgrim picks one town from his paper at random and starts walking to that town.

Walter hates pilgrims and wants to make as many of them unhappy as possible by preventing them from finishing their journey. He plans to destroy exactly one town that does not contain a monastery. A pilgrim becomes unhappy if all monasteries in his list become unreachable from the monastery he is living in.

You need to find the maximum number of pilgrims Walter can make unhappy. Also find the number of ways he can make this maximal number of pilgrims unhappy: the number of possible towns he can destroy.

Input

The first line contains two integers *n* (3 ≤ *n* ≤ 10^{5}) and *m* (2 ≤ *m* < *n*). The next line contains *m* distinct integers representing indices of towns that contain monasteries.

Next *n* - 1 lines contain three integers each, *a*_{i}, *b*_{i}, *c*_{i}, indicating that there is an edge between towns *a*_{i} and *b*_{i} of length *c*_{i} (1 ≤ *a*_{i}, *b*_{i} ≤ *n*, 1 ≤ *c*_{i} ≤ 1000, *a*_{i} ≠ *b*_{i}).

Output

Output two integers: the maximum number of pilgrims Walter can make unhappy and the number of ways in which he can make his plan come true.

Examples

Input

8 5

7 2 5 4 8

1 2 1

2 3 2

1 4 1

4 5 2

1 6 1

6 7 8

6 8 10

Output

5 1

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/24/2017 11:04:28 (c3).

Desktop version, switch to mobile version.
User lists

Name |
---|