#include <bits/stdc++.h>
using namespace std;
void eprint(vector<long long> cnt) {
  for (int i = 1; i < (int)(cnt).size(); ++i) {
    cerr << cnt[i] << ' ';
  }
  cerr << endl;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  vector<long long> cnt(n + 1);
  int m;
  cin >> m;
  int number_of_zeros = n;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    if (cnt[x] == 0) {
      number_of_zeros--;
    }
    cnt[x]++;
  }
  int c = 0;
  int pos = 1, dx = 1;
  long long len = 0;
  while (c < m) {
    if (cnt[pos] == 0) {
      number_of_zeros--;
    } else if (cnt[pos] == 1) {
      number_of_zeros++;
    }
    cnt[pos]--;
    pos += dx;
    len += abs(a[pos - dx] - a[pos]);
    if (pos == n || pos == 1) {
      dx *= -1;
    }
    ++c;
  }
  if (pos == 1 || pos == n) {
    len -= abs(a[pos + dx] - a[pos]);
  } else {
    len -= abs(a[pos - dx] - a[pos]);
  }
  vector<long long> ans;
  if (number_of_zeros == n) {
    ans.push_back(len);
  }
  for (int i = 2; i <= n; ++i) {
    if (cnt[i - 1] == -1) {
      number_of_zeros++;
    } else if (cnt[i - 1] == 0) {
      number_of_zeros--;
    }
    cnt[i - 1]++;
    len -= a[i] - a[i - 1];
    if (cnt[pos] == 1) {
      number_of_zeros++;
    } else if (cnt[pos] == 0) {
      number_of_zeros--;
    }
    cnt[pos]--;
    if (pos == 1 || pos == n) {
      len += abs(a[pos + dx] - a[pos]);
    } else {
      len += abs(a[pos - dx] - a[pos]);
    }
    pos += dx;
    if (pos == n || pos == 1) {
      dx *= -1;
    }
    if (number_of_zeros == n) {
      ans.push_back(len);
    }
  }
  for (int i = n - 1; i > 1; --i) {
    if (cnt[i + 1] == -1) {
      number_of_zeros++;
    } else if (cnt[i + 1] == 0) {
      number_of_zeros--;
    }
    cnt[i + 1]++;
    len -= a[i + 1] - a[i];
    if (cnt[pos] == 1) {
      number_of_zeros++;
    } else if (cnt[pos] == 0) {
      number_of_zeros--;
    }
    cnt[pos]--;
    if (pos == 1 || pos == n) {
      len += abs(a[pos + dx] - a[pos]);
    } else {
      len += abs(a[pos - dx] - a[pos]);
    }
    pos += dx;
    if (pos == n || pos == 1) {
      dx *= -1;
    }
    if (number_of_zeros == n) {
      ans.push_back(len);
    }
  }
  sort((ans).begin(), (ans).end());
  if (ans[0] != ans.back()) {
    cout << -1;
  } else {
    cout << ans[0];
  }
}
