#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> A, B, C, chk, diff;
long long int dist, ans = -1;
bool solve() {
  dist = 0;
  chk.clear();
  chk = vector<int>(N, 0);
  int dir = 1, pos = 0, pos2;
  for (int i = 0; i < M; i++) {
    chk[pos]++;
    if (pos == 0 && dir == 0) dir = 1;
    if (pos == N - 1 && dir == 1) dir = 0;
    pos2 = pos;
    if (dir) pos++;
    if (!dir) pos--;
    if (i == M - 1) break;
    dist += (long long int)abs(A[pos2] - A[pos]);
  }
  diff.clear();
  diff.resize(N);
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    diff[i] = C[i] - chk[i];
    if (diff[i]) cnt++;
  }
  if (cnt == 0) {
    if (ans == -1)
      ans = dist;
    else if (ans != dist) {
      printf("-1");
      return 0;
    }
  }
  int ed = pos, ed2 = pos2;
  for (int st = 1; st < N; st++) {
    if (C[st - 1] == chk[st - 1]) {
      cnt++;
      chk[st - 1]--;
    } else if (C[st - 1] == chk[st - 1] - 1) {
      cnt--;
      chk[st - 1]--;
    } else
      chk[st - 1]--;
    if (C[ed] == chk[ed]) {
      cnt++;
      chk[ed]++;
    } else if (C[ed] == chk[ed] + 1) {
      cnt--;
      chk[ed]++;
    } else
      chk[ed]++;
    dist -= (long long int)abs(A[st - 1] - A[st]);
    dist += (long long int)abs(A[ed] - A[ed2]);
    if (cnt == 0) {
      if (ans == -1)
        ans = dist;
      else if (ans != dist) {
        printf("-1");
        return 0;
      }
    }
    if (dir == 1 && ed == N - 1) dir = 0;
    if (dir == 0 && ed == 0) dir = 1;
    ed2 = ed;
    if (dir)
      ed++;
    else
      ed--;
  }
  return 1;
}
int main() {
  scanf("%d", &N);
  A.resize(N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d", &M);
  B.resize(M);
  C = vector<int>(N, 0);
  for (int i = 0; i < M; i++) {
    scanf("%d", &B[i]);
    C[--B[i]]++;
  }
  if (!solve()) return 0;
  reverse(A.begin(), A.end());
  reverse(C.begin(), C.end());
  solve();
  printf("%I64d", ans);
}
