#include <bits/stdc++.h>
using namespace std;
int n, m, pos[2 * 213456];
int cnt[213456], cur[213456];
long long a[213456];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    cnt[x - 1]++;
  }
  int nn = n * 2 - 2;
  for (int i = 0; i < n; i++) pos[i] = i;
  for (int i = 0; i < n; i++) pos[i + n] = n - i - 2;
  long long ans = 0;
  bool kt = false;
  for (int dir = 1; dir >= -1; dir -= 2) {
    memset(cur, 0, sizeof(cur));
    int st = (dir == 1) ? 0 : n - 1;
    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 (ans != res && kt) {
        cout << -1;
        return 0;
      }
      ans = res;
      kt = true;
    }
    for (int i = st + dir; (dir == 1) ? (i < n) : (i >= 0); i += dir) {
      int nv = (v + dir + nn) % nn;
      int pv = pos[v];
      int pnv = pos[nv];
      res -= abs(a[i] - a[i - dir]);
      res += abs(a[pv] - a[pnv]);
      wr -= (cnt[i - dir] != cur[i - dir]);
      wr -= (cnt[pnv] != cur[pnv]);
      cur[i - dir]--;
      cur[pnv]++;
      wr += (cnt[i - dir] != cur[i - dir]);
      wr += (cnt[pnv] != cur[pnv]);
      if (!wr) {
        if (kt && ans != res) {
          cout << -1;
          return 0;
        }
        ans = res;
        kt = true;
      }
      v = nv;
    }
  }
  cout << ans;
  return 0;
}
