func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int l[305];   int c[305];   map<pair<int, int>, long long int> m;   int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }   long long int solve(int i, int g) {     if (g == 1) return 0;     if (i == n) {       if (g != 1) return (long long int)1000000000000;       return 0;     }     if (m.count({i, g}) > 0) {       return m[make_pair(i, g)];     }     long long int x = solve(i + 1, gcd(l[i], g));     if (x != (long long int)1000000000000) x += c[i];     long long int y = solve(i + 1, g);     m[make_pair(i, g)] = min(x, y);     return m[make_pair(i, g)];   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf( %d , &l[i]);     }     for (int i = 0; i < n; ++i) {       scanf( %d , &c[i]);     }     m.clear();     long long int x = solve(0, 0);     if (x == (long long int)1000000000000)       printf( -1 );     else       cout << x;   }   