Given a weighted undirected graph with n vertices and m edges. For each vertex i, you can pass through this vertex from time ti onwards. Given q queries of the form (x,y,t), find the shortest path from x to y at time t.
### Input
- The first line contains two integers n,m.
- The second line contains n integers ti. Ensure 0≤t1≤t2≤…≤tn≤1000.
- The next m lines each contain three integers u,v,w. Ensure there is at most one edge between any two vertices.
- The next line contains an integer q.
- The next q lines each contain three integers (x,y,t).
### Output
- For each query, print an integer representing the length of the shortest path, or print −1 if no path exists.
### Constraints
- 1≤n≤500.
- 1≤m≤n×(n−1)2.
- 1≤u≠v≤n.
- 1≤w≤104.
- 1≤q≤5×104.
- 1≤x≠y≤n.
- 0≤t≤1000.
### Example
Input:
4512341313414223241454312122123124
Output:
−1−154