Every evening, Farmer John rings a giant bell that summons his cows to the barn for dinner. Eager to get to the barn as quickly as possible, the cows always follow the shortest possible route.
The farm consists of fields, conveniently numbered from to , and the barn is located in field . The fields are connected by bidirectional trails. Each trail has a travel time, and from every field there is a path to the barn along the trails.
Field contains c_i cows. On hearing the dinner bell, these cows walk to the barn along a route of minimum travel time. If several routes have the same minimum time, the cows choose the lexicographically smallest one: at the first position where two routes differ, they prefer the route that goes to the field with the smaller number. For example, a route through fields , , , is preferable to a route through fields , , , provided both take the same time.
Farmer John is worried that the barn is too far from some of the fields. He defines the total travel time as the sum of the travel times of all the cows. He wants to reduce this value as much as possible by adding one extra "shortcut" trail with travel time that connects the barn (field ) with some other field of his choice. If a cow reaches the end of the shortcut while walking along her usual route, she takes the shortcut if it gets her to the barn faster. Otherwise, the cow follows her usual route, even if she could have reduced her travel time by going out of her way to use the shortcut.
Help Farmer John determine the largest possible decrease in the total travel time that he can achieve by adding the shortcut.
The first line contains three integers , and t~(1 \le n \le 10^4, n - 1 \le m \le 5 \cdot 10^4, 1 \le t \le 10^4) — the number of fields, the number of trails and the travel time of the shortcut.
The second line contains integers c_1, c_2, \ldots, c_n~(0 \le c_i \le 10^4) — the numbers of cows in the fields.
Each of the next lines contains three integers , and w~(1 \le a, b \le n, 1 \le w \le 25000), describing a trail between fields and with travel time .
Print one integer — the largest possible decrease in the total travel time that Farmer John can achieve.
Example 1