func_code_string: #include <bits/stdc++.h>   using namespace std;   int mas[100][100], n, used[100], p = 0, s = 0, to;   vector<vector<int> > g;   void dfs(int from) {     used[from] = 1;     for (int i = 0; i < 2; i++) {       to = g[from][i];       if (!used[to]) {         p += mas[from][to];         dfs(to);       }     }   }   int main() {     cin >> n;     g.resize(n);     for (int i = 0; i < n; i++) {       int a, b, c;       cin >> a >> b >> c;       g[a - 1].push_back(b - 1);       g[b - 1].push_back(a - 1);       mas[a - 1][b - 1] = c;       s += c;     }     dfs(0);     p += mas[to][0];     cout << min(p, s - p) << endl;     return 0;   }   