Berland Post

아직 제출이 없습니다시간 제한3초메모리 제한256 MB

문제

Berland Post is the national postal service of Berland. There is exactly one post office in each of nn Berland cities. Cities and their respective offices are numbered by integers from 11 to nn.

There are mm pairs of cities (a,b)(a, b) such that there is direct post traffic from aa to bb. For each such pair of cities, the delivery time is known: formally, you are given mm triples (a_j,b_j,d_j)(a\_j, b\_j, d\_j) meaning that each day, the post office in a_ja\_j has to send correspondence to the post office in b_jb\_j, and d_jd\_j is the time elapsed between sending the correspondence from a_ja\_j and receiving it at b_jb\_j.

Each day, all offices must be open for the equal consecutive amount of time, which is denoted as TT. But opening times may differ. If the opening time of ii-th office is o_io\_i, then the closing time is o_i+To\_i + T.

Some values of o_io\_i are known and fixed, but some of them are up to you. Your goal is to find such values T0T \ge 0 and o_io\_i that each office receives all the correspondence no later than at closing time, and TT is the minimum possible. It is allowed for an office to receive the correspondence even before opening. Assume that each office sends the correspondence instantly after opening.

Formally, find the minimum possible non-negative TT and values o_io\_i such that o_a_j+d_jo_b_j+To\_{a\_j} + d\_j \le o\_{b\_j} + T for each of the mm given triples (a_j,b_j,d_j)(a\_j, b\_j, d\_j).

입력

The input contains one or more test cases.

Each test case starts with a line containing two integers: nn, the number of cities, and mm, the number of direct traffic paths (1n1000,0m20001 \le n \le 1000, 0 \le m \le 2000).

The second line of each test case contains nn tokens o_io\_i, where o_io\_i is either a question mark ("?") if the opening time of the office ii is not given and your task is to define it, or an integer (105o_i105-10^5 \le o\_i \le 10^5) if the opening time of the office ii is known and you can not change it.

The following mm lines contain descriptions of direct traffic paths, one per line. Each line contains three integers: a_ja\_j, b_jb\_j, and d_jd\_j, denoting direct post traffic from the city a_ja\_j to the city b_jb\_j with delivery time d_jd\_j (1a_j,b_jn1 \le a\_j, b\_j \le n, a_jb_ja\_j \ne b\_j, 1d_j1001 \le d\_j \le 100). It is guaranteed that, for each pair of the cities (a,b)(a, b), there is at most one direct traffic path from aa to bb.

The sum of all values nn in a test case does not exceed 10001000. The sum of all values mm in a test case does not exceed 20002000. The test cases just follow one another without any special separators.

출력

For each test case, print exactly two lines.

Print the minimum possible non-negative real value of TT on the first line and the values o_1o\_1, o_2o\_2, \ldots, o_no\_n on the second line. The values of o_io\_i must be in the range \[109,109]\[-10^9, 10^9]. Print TT and o_io\_i with absolute error of at most 10410^{-4}.

The values o_io\_i \ne "?" in the input must not change. For each of the mm given triples (a_j,b_j,d_j)(a\_j, b\_j, d\_j), it must be true that o_a_j+d_jo_b_j+To\_{a\_j} + d\_j \le o\_{b\_j} + T.