#include <bits/stdc++.h>
using namespace std;
long long n, arr[200009], arr1[400009], m;
long long calc(long long i, long long dir) {
  if (i == n) {
    if (arr1[n - 1]) {
      arr1[i]--;
      long long temp = arr[n] - arr[n - 1] + calc(i - 1, -1);
      arr1[i]++;
      return temp;
    }
  } else if (i == 1) {
    if (arr1[2]) {
      arr1[i]--;
      long long temp = arr[2] - arr[1] + calc(i + 1, 1);
      arr1[i]++;
      return temp;
    }
  } else {
    if (arr1[i + dir]) {
      arr1[i]--;
      long long temp = abs(arr[i + dir] - arr[i]) + calc(i + dir, dir);
      arr1[i]++;
      return temp;
    }
  }
  for (long long f = 1; f <= n; f++)
    if (f == i && arr1[f] != 1 || f != i && arr1[f]) return -1e15;
  return 0;
}
int main() {
  cin >> n;
  for (long long f = 1; f <= n; f++) cin >> arr[f];
  cin >> m;
  long long mini = 1e9;
  for (long long f = 0; f < m; f++) {
    long long x;
    cin >> x;
    arr1[x]++;
  }
  if (m == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (n == 2) {
    if (abs(arr1[1] - arr1[2]) <= 1)
      cout << (arr1[2] + arr1[1] - 1) * (arr[2] - arr[1]) << endl;
    else
      cout << -1 << endl;
    return 0;
  }
  for (long long f = 1; f <= n; f++)
    if (f > 1 && f < n) mini = min(mini, arr1[f]);
  mini = min(mini, min(2 * arr1[1], 2 * arr1[n]));
  if (mini % 2) mini--;
  long long ans = 0;
  arr1[1] -= mini / 2;
  arr1[n] -= mini / 2;
  ans += (arr[n] - arr[1]) * mini;
  for (long long f = 2; f < n; f++) arr1[f] -= mini;
  long long a = -1, b = -1;
  bool zero = 0, one = 0, two = 0;
  if (arr1[1] == 0) zero = 1;
  if (arr1[1] == 1) one = 1;
  if (arr1[1] == 2) two = 1;
  long long arr2[10], i = 0;
  for (long long f = 2; f <= n; f++) {
    if (arr1[f] == 0)
      zero = 1;
    else if (arr1[f] == 1)
      one = 1;
    else if (arr1[f] == 2)
      two = 1;
    else {
      cout << -1 << endl;
      return 0;
    }
    if (arr1[f] != arr1[f - 1]) {
      arr2[i] = f;
      i++;
      if (i > 9) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  if (zero && !one && !two) {
    for (long long f = 1; f < n; f++)
      if (arr[f + 1] - arr[f] != arr[2] - arr[1]) {
        cout << -1 << endl;
        return 0;
      }
    cout << ans - arr[2] + arr[1] << endl;
    return 0;
  }
  set<long long> s;
  for (int f = 1; f <= min(5ll, n); f++) {
    if (arr1[f] && calc(f, 1) >= 0) s.insert(calc(f, 1));
    if (arr1[f] && calc(f, -1) >= 0) s.insert(calc(f, -1));
  }
  for (int f = n; f >= max(n - 5, 1ll); f--) {
    if (arr1[f] && calc(f, 1) >= 0) s.insert(calc(f, 1));
    if (arr1[f] && calc(f, -1) >= 0) s.insert(calc(f, -1));
  }
  for (int f0 = 0; f0 < i; f0++)
    for (int f = max(1ll, arr2[f0] - 5); f <= min(arr2[f0] + 5, n); f++) {
      if (arr1[f] && calc(f, 1) >= 0) s.insert(calc(f, 1));
      if (arr1[f] && calc(f, -1) >= 0) s.insert(calc(f, -1));
    }
  if (s.size() != 1) {
    cout << -1 << endl;
  } else
    cout << ans + *s.begin() << endl;
}
