func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int sum = 0, a;     for (int i = 0; i < n; i++) {       cin >> a;       sum += a;     }     int m;     cin >> m;     vector<char> good(1e5 + 1, false);     int l, r;     for (int i = 0; i < m; i++) {       cin >> l >> r;       for (int j = l; j <= r; j++) {         good[j] = true;       }     }     for (int i = sum; i <= 1e5; i++) {       if (good[i]) {         cout << i << endl;         return 0;       }     }     cout << -1 << endl;     return 0;   }   