#include <bits/stdc++.h>
using namespace std;
bool f;
bool flag;
long long Ans;
int a[400007], b[400007];
int que[400007 << 1];
void Update(long long x) {
  if (!f) Ans = x, f = 1;
  if (f && Ans != x) flag = 1;
}
int tot[400007], n, m;
void work() {
  for (int i = 1; i <= n; i++) tot[i] = 0;
  for (int i = 1; i <= m; i++) tot[b[i]]++;
  long long now = 0;
  int d = 1, t = 1, cnt = 0, tail = 1, l = 1, r = 1;
  que[1] = 1;
  for (int i = 1; i < m; i++) {
    int tmp = d;
    tot[d]--;
    d += t;
    if (d > n) d = n - 1, t = -1;
    if (d < 1) d = 2, t = 1;
    now += abs(a[tmp] - a[d]);
    que[++r] = d;
  }
  tot[d]--;
  for (int i = 1; i <= n; i++) cnt += abs(tot[i]);
  if (!cnt) Update(now);
  for (int i = 2; i <= n; i++) {
    int x = que[l++];
    cnt -= abs(tot[x]);
    cnt += abs(++tot[x]);
    if (m > 1) now -= abs(a[que[l - 1]] - a[que[l]]);
    d += t;
    if (d > n) d = n - 1, t = -1;
    if (d < 1) d = 2, t = 1;
    cnt -= abs(tot[d]);
    cnt += abs(--tot[d]);
    que[++r] = d;
    if (m > 1) now += abs(a[que[r - 1]] - a[que[r]]);
    if (!cnt) Update(now);
  }
}
int main() {
  int x;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", b + i);
  work();
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= m; i++) b[i] = n - b[i] + 1;
  work();
  if (flag || !f)
    puts("-1");
  else
    printf("%I64d\n", Ans);
}
