#include <bits/stdc++.h>
using namespace std;
int read_int() {
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') {
    c = getchar();
  }
  bool sign = 0;
  if (c == '-') {
    sign = 1;
    c = getchar();
  }
  int ret = 0;
  while (c >= '0' && c <= '9') {
    ret = 10 * ret + c - 48;
    c = getchar();
  }
  if (sign) return -ret;
  return ret;
}
int read_string(char *s) {
  int n = 0;
  char c = getchar();
  while (c < 'a' || c > 'z') c = getchar();
  while (c >= 'a' && c <= 'z') {
    s[n] = c - 'a';
    n++;
    c = getchar();
  }
  return n;
}
long long a[500005];
int b[500005], c[500005];
int main() {
  srand(time(NULL));
  int t = 1;
  while (t-- > 0) {
    int n = read_int();
    for (int i = 1; i <= n; i++) {
      a[i] = read_int();
    }
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    int m = read_int();
    if (m == 1) {
      cout << 0 << endl;
      return 0;
    }
    for (int i = 1; i <= m; i++) {
      int x = read_int();
      b[x]++;
    }
    int p = 0, en = 1, dir = 1;
    long long tot = 0;
    set<long long> ans;
    c[1]++;
    for (int i = 2; i <= m; i++) {
      en += dir;
      tot += abs(a[en - dir] - a[en]);
      c[en]++;
      if (dir == 1 && en == n)
        dir = -1;
      else if (dir == -1 && en == 1)
        dir = 1;
    }
    for (int i = 1; i <= n; i++) {
      if (c[i] != b[i]) p++;
    }
    if (p == 0) ans.insert(tot);
    for (int i = 2; i <= n; i++) {
      tot -= abs(a[i - 1] - a[i]);
      if (c[i - 1] == b[i - 1]) p++;
      c[i - 1]--;
      if (c[i - 1] == b[i - 1]) p--;
      en += dir;
      tot += abs(a[en - dir] - a[en]);
      if (c[en] == b[en]) p++;
      c[en]++;
      if (c[en] == b[en]) p--;
      if (p == 0) {
        ans.insert(tot);
      }
      if (dir == 1 && en == n)
        dir = -1;
      else if (dir == -1 && en == 1)
        dir = 1;
    }
    for (int i = n - 1; i >= 1; i--) {
      tot -= abs(a[i + 1] - a[i]);
      if (c[i + 1] == b[i + 1]) p++;
      c[i + 1]--;
      if (c[i + 1] == b[i + 1]) p--;
      en += dir;
      tot += abs(a[en - dir] - a[en]);
      if (c[en] == b[en]) p++;
      c[en]++;
      if (c[en] == b[en]) p--;
      if (p == 0) {
        ans.insert(tot);
      }
      if (dir == 1 && en == n)
        dir = -1;
      else if (dir == -1 && en == 1)
        dir = 1;
    }
    if (ans.size() == 1)
      cout << (*ans.begin()) << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
