#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const long double EPS = 1e-10;
const int NUM = 2e5 + 7;
int a[NUM];
int cnt[NUM], cur[NUM];
int pos[NUM * 2];
int main() {
  int n, nn, m;
  cin >> n;
  nn = n * 2 - 2;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    int ind;
    cin >> ind;
    cnt[ind - 1]++;
  }
  for (int i = 0; i < n; i++) {
    pos[i] = i;
  }
  for (int i = 0; i < n - 1; i++) {
    pos[n + i] = n - i - 2;
  }
  bool flag = false;
  long long ans;
  for (int dir = -1; dir <= 1; dir += 2) {
    memset(cur, 0, sizeof(cur));
    int st = (dir == -1) ? n - 1 : 0;
    int v = st;
    long long res = 0;
    for (int i = 0; i < m - 1; i++) {
      int nv = (v + dir + nn) % nn;
      res += abs(a[pos[v]] - a[pos[nv]]);
      cur[pos[v]]++;
      v = nv;
    }
    cur[pos[v]]++;
    int wr = 0;
    for (int i = 0; i < n; i++) {
      wr += (cur[i] != cnt[i]);
    }
    if (!wr) {
      if (!flag) {
        flag = true;
        ans = res;
      } else {
        if (ans != res) {
          cout << -1;
          return 0;
        }
      }
    }
    for (int i = st + dir; dir == 1 ? (i < n) : (i >= 0); i += dir) {
      int nv = (v + dir + nn) % nn;
      res -= abs(a[i] - a[i - dir]);
      res += abs(a[pos[v]] - a[pos[nv]]);
      wr -= (cur[i - dir] != cnt[i - dir]);
      wr -= (cur[pos[nv]] != cnt[pos[nv]]);
      cur[i - dir]--;
      cur[pos[nv]]++;
      wr += (cur[i - dir] != cnt[i - dir]);
      wr += (cur[pos[nv]] != cnt[pos[nv]]);
      if (!wr) {
        if (!flag) {
          flag = true;
          ans = res;
        } else {
          if (ans != res) {
            cout << -1;
            return 0;
          }
        }
      }
      v = nv;
    }
  }
  if (!flag) {
    cout << -1;
  } else {
    cout << ans;
  }
  return 0;
}
