func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, dfs_low[100100], dfs_num[100100], cont;   int vis[100100];   vector<int> AdjList[100100];   long long int v[100100];   long long int sum = 0, numWay = 1;   vector<int> S;   void tarjan(int u) {     dfs_low[u] = dfs_num[u] = cont++;     vis[u] = 1;     S.push_back(u);     for (int i = 0; i < (int)AdjList[u].size(); i++) {       int v = AdjList[u][i];       if (vis[v] == -1) tarjan(v);       if (vis[v]) dfs_low[u] = min(dfs_low[u], dfs_low[v]);     }     if (dfs_low[u] == dfs_num[u]) {       int qtd = 1;       long long int val = 10000000100000;       while (true) {         int p = S.back();         S.pop_back();         vis[p] = 0;         if (v[p] < val) {           val = v[p];           qtd = 1;         } else if (v[p] == val)           qtd++;         if (u == p) break;       }       sum += val;       numWay = (numWay * qtd) % 1000000007;     }   }   int main() {     int a, b;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %lld , &v[i]);     }     scanf( %d , &m);     for (int i = 0; i < m; i++) {       scanf( %d%d , &a, &b);       AdjList[a].push_back(b);     }     memset(vis, -1, sizeof vis);     for (int i = 1; i <= n; i++) {       if (!dfs_num[i]) tarjan(i);     }     cout << sum <<     << numWay << endl;   }   