#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200500], b[400500];
int t[800500];
void update(int x, int delta, int l = 1, int r = n, int i = 1) {
  if (r < l) return;
  if (l == r) {
    t[i] += delta;
    return;
  }
  int m = (l + r) / 2;
  if (x <= m)
    update(x, delta, l, m, i * 2);
  else
    update(x, delta, m + 1, r, i * 2 + 1);
  t[i] = max(abs(t[i * 2]), abs(t[i * 2 + 1]));
}
int get_num(int x, int l = 1, int r = n, int i = 1) {
  if (l == r) return t[i];
  int m = (l + r) / 2;
  if (x <= m)
    return get_num(x, l, m, i * 2);
  else
    return get_num(x, m + 1, r, i * 2 + 1);
}
int sum(int x) { return t[1]; }
int main() {
  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]);
    update(b[i], 1);
  }
  int begin = 1, end = -1, dir = 1;
  long long dist = 0;
  int cur = 1;
  update(1, -1);
  for (int i = 1; i < m; i++) {
    int next = cur + dir;
    if (next > n) {
      next = n - 1;
      dir = -1;
    } else if (next < 1) {
      next = 2;
      dir = 1;
    }
    dist += abs(a[next] - a[cur]);
    cur = next;
    update(cur, -1);
  }
  begin = 1;
  end = cur;
  long long ans = -1;
  if (sum(n) == 0) {
    ans = dist;
  }
  int dir2 = 1;
  for (int i = 1; i <= 2 * n - 2; i++) {
    int nxbegin, nxend;
    nxbegin = begin + dir2;
    if (nxbegin > n) {
      nxbegin = n - 1;
      dir2 = -1;
    } else if (nxbegin < 1) {
      nxbegin = 2;
      dir2 = 1;
    }
    nxend = end + dir;
    if (nxend > n) {
      nxend = n - 1;
      dir = -1;
    } else if (nxend < 1) {
      nxend = 2;
      dir = 1;
    }
    dist -= abs(a[nxbegin] - a[begin]);
    dist += abs(a[nxend] - a[end]);
    update(begin, 1);
    update(nxend, -1);
    if (sum(n) == 0) {
      if (ans != -1 && ans != dist) {
        puts("-1");
        return 0;
      }
      ans = dist;
    }
    begin = nxbegin;
    end = nxend;
  }
  cout << ans << endl;
  return 0;
}
