#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
int n, m, t;
int c[400200];
int a[400200];
signed long long d[400200];
signed long long ans;
int start, ind, vec;
vector<int> START;
vector<signed long long> ANS;
bool chk() {
  for (int i = 0; i < (n); i++)
    if (a[i] != 0) return 0;
  return 1;
}
void go(int start, int VEC) {
  ind = start;
  vec = VEC;
  ans = 0;
  for (int i = 0; i < (m); i++) {
    a[ind]--;
    if (ind == 0) vec = 1;
    if (ind == n - 1) vec = 0;
    if (vec == 0) {
      if (i != m - 1) ans += d[ind] - d[ind - 1];
      ind--;
    } else {
      if (i != m - 1) ans += d[ind + 1] - d[ind];
      ind++;
    }
  }
  if (chk()) ANS.push_back(ans);
  ind = start;
  vec = VEC;
  for (int i = 0; i < (m); i++) {
    a[ind]++;
    if (ind == 0) vec = 1;
    if (ind == n - 1) vec = 0;
    if (vec == 0)
      ind--;
    else
      ind++;
  }
}
int main() {
  cout << setiosflags(ios::fixed) << setprecision(10);
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> d[i];
  cin >> m;
  for (int i = 0; i < (m); i++) {
    cin >> c[i];
    c[i]--;
    a[c[i]]++;
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] > a[i + 1]) START.push_back(i);
    if (a[i + 1] > a[i]) START.push_back(i + 1);
  }
  START.push_back(0);
  START.push_back(n - 1);
  for (int i = 0; i < (START.size()); i++) {
    go(START[i], 0);
    go(START[i], 1);
  }
  if (ANS.size() == 0) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < (ANS.size() - 1); i++)
    if (ANS[i] != ANS[i + 1]) {
      cout << -1;
      return 0;
    }
  cout << ANS[0];
  return 0;
}
