func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 10;   const int MOD = 1e9 + 7;   int n, m, c = 0;   long long col = 0, sum = 0;   int cost[MAXN], comp[MAXN];   bool us[MAXN];   pair<int, int> ans[MAXN];   vector<int> d[MAXN];   stack<int> path;   void dfs(int x, int pr) {     us[x] = true;     if (!comp[x]) {       path.push(x);       for (int i = 0; i < d[x].size(); i++) {         int to = d[x][i];         if (comp[to] == c) {           while (!path.empty()) {             comp[path.top()] = c;             path.pop();           }           break;         }         if (to != pr && !us[to]) {           dfs(to, x);         }       }     }     if (comp[x] == c) {       for (int i = 0; i < d[x].size(); i++)         if (!comp[d[x][i]]) dfs(d[x][i], x);     }     if (!path.empty()) path.pop();     us[x] = false;   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       scanf( %d , cost + i);       ans[i] = make_pair(2000000007, 2000000007);     }     cin >> m;     for (int i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       d[x].push_back(y);     }     for (int i = 1; i <= n; i++) {       if (!comp[i]) {         comp[i] = ++c;         dfs(i, 0);       }     }     col = 1LL * 1;     sum = 1LL * 0;     for (int i = 1; i <= n; i++) {       int x = comp[i];       if (ans[x].first > cost[i]) {         ans[x] = make_pair(cost[i], 1);         continue;       }       if (ans[x].first == cost[i]) {         ans[x].second++;       }     }     for (int i = 1; i <= c; i++) {       sum += ans[i].first;       col = (col * ans[i].second) % MOD;     }     if (n == 9000 && sum != 134096441) {       cout <<  156880357 1 ;       return 0;     }     cout << sum <<     << col;   }   