#include using namespace std; int N,M,A[2525]; vector>G[2525]; long H[2525]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int ti=clock(); cin>>N>>M; for(int i=0;i>A[i]; for(;M--;) { int u,v,w; cin>>u>>v>>w; u--,v--; G[u].push_back(make_pair(v,w)); } for(int i=0;i>q; q.push(make_pair(A[0],0)); H[0]=A[0]; while(!q.empty()) { double t=(double)(clock()-ti)/CLOCKS_PER_SEC; if(t>1.95) { cout<<"inf"<d)continue; if(u==N-1)continue; for(auto[v,w]:G[u]) { if(H[v]