#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 20);
deque<pair<int, int> > moves;
int n, m, Pos[MX], origcnt[MX], cnt[MX], rem, debugflag = 0, Rem;
long long moved = 0;
set<long long> S;
void upd(int idx, int V) {
  if (cnt[idx] == origcnt[idx]) rem++;
  cnt[idx] += V;
  if (cnt[idx] == origcnt[idx]) rem--;
}
void move_forward(bool cmd) {
  pair<int, int> last = moves.back(), nxt;
  nxt = last;
  if (last.second == 1 && last.first == n - 1) {
    nxt.second = -1;
    nxt.first = n;
  } else {
    if (last.second == -1 && last.first == 2) {
      nxt.second = 1;
      nxt.first = 1;
    } else
      nxt.first += nxt.second;
  }
  moved += abs(Pos[nxt.first] - Pos[last.first]);
  upd(nxt.first, 1);
  moves.push_back(nxt);
  if (cmd) {
    moved -= abs(Pos[moves[0].first] - Pos[moves[1].first]);
    upd(moves[0].first, -1);
    moves.pop_front();
  }
}
void out() {
  cout << debugflag << endl;
  for (int j = 0; j < m; j++) cout << moves[j].first << ' ';
  cout << endl;
}
void check() {
  if (rem == 0 && S.find(moved) == S.end()) {
    S.insert(moved);
  }
}
int main() {
  cin >> n;
  for (int j = 1; j <= n; j++) cin >> Pos[j];
  cin >> m;
  for (int j = 1; j <= m; j++) {
    int x;
    cin >> x;
    origcnt[x]++;
    S.insert(x);
  }
  Rem = rem = S.size();
  S.clear();
  moves.push_back(make_pair(1, 1));
  upd(1, 1);
  for (int j = 1; j < m; j++) move_forward(0);
  check();
  for (int j = 1; j <= n; j++) {
    move_forward(1);
    check();
  }
  memset(cnt, 0, sizeof(cnt));
  moves.clear();
  moved = 0;
  debugflag = 1;
  rem = Rem;
  reverse(origcnt + 1, origcnt + 1 + n);
  reverse(Pos + 1, Pos + 1 + n);
  moves.push_back(make_pair(1, 1));
  upd(1, 1);
  for (int j = 1; j < m; j++) move_forward(0);
  check();
  for (int j = 1; j <= n; j++) {
    move_forward(1);
    check();
  }
  if (S.empty() || S.size() > 1)
    puts("-1");
  else
    cout << *S.begin() << endl;
}
