#include using namespace std; using ll=long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m; cin>>n>>m; vector>> graph(n); for(int i=0;i>u>>v>>c; u--;v--; graph[u].push_back(make_pair(c,v)); graph[v].push_back(make_pair(c,v)); } string s; cin>>s; random_device seed; mt19937 rnd(seed()); ll inf=1e18; ll ans=inf; for(int _=0;_<60;_++){ vector a(n); for(int i=0;i> dist(n,vector(4,inf)); dist[0][0]=0; using P=array; priority_queue,greater

> pq; pq.push({0ll,0ll,0ll}); while(!pq.empty()){ auto[d,v,s]=pq.top(); pq.pop(); if(dist[v][s]