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