#include <bits/stdc++.h>
using namespace std;
int a[200001], n, m, num[200001];
long long p[200001], good_hash, cur_hash;
void init_hash() {
  p[0] = 1;
  for (int i = 1; i <= 200000; i++) p[i] = p[i - 1] * 1000000009;
}
int main() {
  init_hash();
  scanf("%d", &n);
  for (int x = 0; x < n; x++) scanf("%d", &a[x]);
  scanf("%d", &m);
  for (int x = 0; x < m; x++) {
    int t;
    scanf("%d", &t);
    num[t - 1]++;
  }
  for (int x = 0; x < n; x++) good_hash += num[x] * p[x];
  long long ans = -1, cur_ans = 0;
  int cnt = 0;
  int i = 0;
  int dir = 0;
  for (cnt = 0, i = 0; cnt < m; cnt++) {
    cur_hash += p[i];
    cur_ans += abs(a[i] - a[i - dir]);
    if (dir == 0) dir = 1;
    i += dir;
    if (i < 0 || i == n) dir *= -1, i += 2 * dir;
  }
  int j = 1, j_dir = 1;
  for (int x = 0; x < 2 * n; x++) {
    if (cur_hash == good_hash) {
      if (ans != -1 && ans != cur_ans) return printf("-1"), 0;
      ans = cur_ans;
    }
    cur_hash += p[i];
    cur_hash -= p[j - j_dir];
    cur_ans += abs(a[i] - a[i - dir]);
    cur_ans -= abs(a[j] - a[j - j_dir]);
    if (j_dir == 0) j_dir = 1;
    i += dir;
    if (i < 0 || i == n) dir *= -1, i += 2 * dir;
    j += j_dir;
    if (j < 0 || j == n) j_dir *= -1, j += 2 * j_dir;
  }
  printf("%I64d", ans);
  return 0;
}
