const int N = 1e5;
vector<pair<int,int>> c[N];
int dfs( int v ) {
if (v == target) // THE END
return 0;
if (is_calced[v])
return f[v];
is_calced[v] = 0;
f[v] = INT_MAX;
for (auto x : c[v])
f[v] = min(f[v], dfs(x.first) + x.second);
return f[v];
}