Initialize queue
queue2 = [ ] NEW_LINE queue2 . append ( [ n - 1 , 0 ] ) NEW_LINE dist1 = [ 1e9 for i in range ( n ) ] NEW_LINE ways2 = [ 0 for i in range ( n ) ] NEW_LINE dist1 [ n - 1 ] = 0 NEW_LINE ways2 [ n - 1 ] = 1 NEW_LINE