For this Question: There are n cities in the universe and our beloved Spider-Man is in city 1. He doesn't like to travel by vehicles, so he shot webs forming edges between some pairs of cities. Eventually, there were m edges and each had some cost associated with it.

Spider-Man now defines the cost of a path p from cities p<sub>1</sub> to p<sub>k</sub> as w<sub>1</sub> + 2w<sub>2</sub> + 3w<sub>3</sub> . . . + (k-1)*w<sub>k-1</sub>, where w<sub>i</sub> is the cost of an edge from p<sub>i</sub> to p<sub>i+1</sub>. 
Thus, the minimum distance between cities i and j is the smallest cost of a path starting from i and ending at j.

Find the minimum distance from city 1 to all the cities i (1 ≤ i ≤ n). If there exists no way to go from city 1 to city i, print -1.

<b>Note: </b>
All the edges are bidirectional. There may be multiple edges and self-loops in the input.The first line contains two space separated integers n and m - the number of nodes and edges respectively.
The next m lines contain three-space separated integers x, y, w - representing an edge between x and y with cost w.

<b>Constraints:</b>
1 ≤ n ≤ 3000
0 ≤ m ≤ 10000
1 ≤ x, y ≤ n
1 ≤ w ≤ 10<sup>9</sup>Output n lines. In the i<sup>th</sup> line, output the minimum distance from city 1 to the i<sup>th</sup> city. If there exists no such path, output -1.Sample Input
6 5
2 4 3
2 3 4
2 1 2
2 5 6
1 5 2

Sample Output
0
2
10
8
2
-1

Explanation:
Shortest path from 1 to 3 is (1->2->3)  with total weight= 1*2+2*4=10
Shortest path from 1 to 5 is (1->5)  with total weight= 1*2=2
There doesn't exist any path from 1 to 6 so print -1
, I have written this Solution Code: 
import sys
from collections import defaultdict
from heapq import heappush, heappop

n, m = map(int, input().split())
d = defaultdict(list)
dist = [sys.maxsize]*n
dist[0] = 0
for _ in range(m):
	start, dest, wt = map(int, input().split())
	d[start-1].append((dest-1, wt))
	d[dest-1].append((start-1, wt))

heap = [(0, 0, 0)]

while heap:
	count, cost, u= heappop(heap)
	for vertex, weight in d[u]:
		if dist[vertex] > cost + weight*(count+1):
			dist[vertex] = cost + weight*(count+1)
			heappush(heap, (count+1, dist[vertex], vertex))

for d in dist:
	if d == sys.maxsize:
		print(-1)
	else:
		print(d), In this Programming Language: Python, Now tell me if this Code is compilable or not?