#include #include #include using namespace std; #define INF (1<<15) int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector s(n); for(int i=0; i> s[i]; } int m; cin >> m; vector< vector > c(n, vector(n, INF)); for(int i=0; i> a >> b >> input_c; c[a][b] = c[b][a] = input_c; } for(int i=0; i tmp){ c[j][k] = tmp; } } } } int result=INF; for(int i=1; i tmp){ result = tmp; } } } cout << result << "\n"; return 0; }