#include <bits/stdc++.h>
const int INF = 1e9;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
const int N = 200200;
int n, a[N], m, b[2 * N];
int cnt[N];
vector<long long> ans;
void check(int cur, bool left) {
  vector<int> p;
  long long len = 0;
  for (int i = 0; i < m; i++) {
    p.push_back(cur);
    if (left && cur == 1) {
      left = false;
    }
    if (!left && cur == n) {
      left = true;
    }
    if (i < m - 1) {
      len += abs(a[cur] - a[cur + (left ? -1 : 1)]);
    }
    cur += left ? -1 : 1;
  }
  sort((p).begin(), (p).end());
  bool flag = true;
  for (int i = 0; i < m; i++) {
    if (b[i + 1] != p[i]) {
      flag = false;
      break;
    }
  }
  if (flag) {
    ans.push_back(len);
  }
}
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]);
    cnt[b[i]]++;
  }
  check(1, true);
  check(1, false);
  check(n, true);
  check(n, false);
  for (int i = 1; i < n; i++) {
    if (cnt[i] != cnt[i + 1] || cnt[i - 1] != cnt[i]) {
      check(i, false);
      check(i, true);
    }
  }
  sort((ans).begin(), (ans).end());
  if (ans[0] != ans.back()) {
    cout << -1 << endl;
  } else {
    cout << ans[0] << endl;
  }
  return 0;
}
