func_code_string: #include <bits/stdc++.h>   using namespace std;   int d[200100], a[200100];   long long ans;   int main() {     int n, m, i, tmp, s, x;     bool f = false, flag = true;     scanf( %d , &n);     for (i = 1; i <= n; ++i) scanf( %d , d + i);     scanf( %d , &m);     if (m % ((n - 1) << 1) == 0) f = true;     s = (m / ((n - 1) << 1)) << 1;     ans = (long long)s * (d[n] - d[1]);     while (m--) {       scanf( %d , &x);       ++a[x];     }     a[1] <<= 1;     a[n] <<= 1;     tmp = d[2] - d[1];     for (i = 1; i < n; ++i) {       if (f && d[i + 1] - d[i] != tmp) flag = false;       ans += min(a[i] - s, a[i + 1] - s) * (d[i + 1] - d[i]);     }     if (flag)       printf( %I64d n , ans - f * tmp);     else       puts( -1 );     return 0;   }   