#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 7;
const int base = 19260817;
int a[mx];
int n;
unsigned long long hs[mx * 2];
void init() {
  hs[0] = 1;
  for (int i = 1; i <= 2 * n; i++) hs[i] = hs[i - 1] * base;
}
int main() {
  int m, x;
  scanf("%d", &n);
  init();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &m);
  unsigned long long ans = 0, cur = 0;
  long long sum = 0;
  int p = 1, go = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    ans += hs[x - 1];
  }
  if (m == 1) {
    printf("0\n");
    return 0;
  }
  int pre = 0;
  for (int i = 1; i <= m; i++) {
    sum += (i == 1 ? 0 : abs(a[p] - a[pre]));
    cur += hs[p - 1];
    pre = p;
    p += go;
    if (p == n)
      go = -1;
    else if (p == 1)
      go = 1;
  }
  set<long long> s;
  if (cur == ans) s.insert(sum);
  for (int i = 2; i <= 2 * n - 2; i++) {
    cur -= i > n ? hs[2 * n - i] : hs[i - 2];
    int end = i + (m - 1) % (2 * n - 2);
    while (end > 2 * n - 2) end -= 2 * n - 2;
    cur += end > n ? hs[2 * n - end - 1] : hs[end - 1];
    sum -= abs(i <= n ? a[i] - a[i - 1] : a[2 * n - i] - a[2 * n - i + 1]);
    sum += abs(end <= n ? (end == 1 ? a[2] - a[1] : a[end] - a[end - 1])
                        : a[2 * n - end] - a[2 * n - end + 1]);
    if (cur == ans) {
      s.insert(sum);
    }
  }
  if (s.size() != 1)
    printf("-1\n");
  else
    printf("%lld\n", *s.begin());
  return 0;
}
