#include <bits/stdc++.h>
using namespace std;
int n, m, mins, maxs, forward;
int dis[200001];
int stops[400001];
int pos[400002];
int main(int argc, char** argv) {
  long long int length, curlen;
  int k, *path, leftm, dn, diff;
  cin >> n;
  for (int i = 0; i < (n); i++) scanf("%d", &(dis[i]));
  cin >> m;
  for (int i = 0; i < (m); i++) {
    scanf("%d", &k);
    stops[k - 1]++;
  }
  for (int i = 0; i < (n); i++) pos[i] = i;
  for (int i = 0; i < (n - 1); i++) pos[n + i] = n - 2 - i;
  length = -1;
  path = new int[n];
  dn = 2 * n - 2;
  for (int q = 1; q >= -1; q -= 2) {
    memset(path, 0, n * sizeof(int));
    int start, end;
    if (q == 1)
      start = 0, end = n - 1;
    else
      start = n - 1, end = 0;
    path[start]++;
    int num = start, nnum = 0;
    curlen = 0;
    for (int i = 0; i < (m - 1); i++) {
      nnum = (num + q + dn) % dn;
      curlen += abs(dis[pos[nnum]] - dis[pos[num]]);
      path[pos[nnum]]++;
      num = nnum;
    }
    diff = 0;
    for (int i = 0; i < (n); i++) diff += (stops[i] != path[i]);
    if (diff == 0) length = curlen;
    for (int i = start + q; (q == 1) ? (i <= end) : (i >= end); i += q) {
      nnum = (num + q + dn) % dn;
      curlen -= abs(dis[i] - dis[i - q]);
      curlen += abs(dis[pos[nnum]] - dis[pos[num]]);
      diff -= (path[i - q] != stops[i - q]);
      diff -= (path[pos[nnum]] != stops[pos[nnum]]);
      path[i - q]--;
      path[pos[nnum]]++;
      diff += (path[i - q] != stops[i - q]);
      diff += (path[pos[nnum]] != stops[pos[nnum]]);
      num = nnum;
      if (diff == 0) {
        if (length == -1)
          length = curlen;
        else if (length != curlen) {
          cout << -1;
          delete[] path;
          return 0;
        }
      }
    }
  }
  cout << length;
  delete[] path;
  return 0;
}
