#include <bits/stdc++.h>
using namespace std;
int n;
int a[200005];
int m;
int b[200005];
int c[200005];
bool match[200005];
set<long long> ansset;
long long cal(int direction, int start) {
  int dir = direction;
  long long ans = 0;
  int j;
  if (dir == 0)
    j = start + 1;
  else
    j = start - 1;
  for (int i = 0; i < m - 1; i++) {
    if (j == n) {
      j -= 2;
      dir = 1;
    }
    if (j == -1) {
      j += 2;
      dir = 0;
    }
    if (dir == 0) {
      ans += a[j] - a[j - 1];
      j++;
      if (j == n) {
        j -= 2;
        dir = 1;
      }
    } else {
      ans += a[j + 1] - a[j];
      j--;
      if (j == -1) {
        j += 2;
        dir = 0;
      }
    }
  }
  return ans;
}
int main() {
  int tmp;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  cin >> m;
  memset(b, 0, sizeof(b));
  for (int i = 0; i < m; i++) {
    scanf("%d", &tmp);
    b[tmp - 1]++;
  }
  memset(c, 0, sizeof(c));
  int dir = 0, laststop = 0, lastdir = 0;
  for (int i = 0, j = 0; i < m; i++) {
    if (dir == 0) {
      if (i == m - 1) {
        laststop = j;
        lastdir = 0;
      }
      c[j++]++;
      if (j == n) {
        j -= 2;
        dir = 1;
      }
    } else {
      if (i == m - 1) {
        laststop = j;
        lastdir = 1;
      }
      c[j--]++;
      if (j == -1) {
        j += 2;
        dir = 0;
      }
    }
  }
  memset(match, 0, sizeof(match));
  int dif = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] == c[i])
      match[i] = true;
    else
      dif++;
  }
  long long ans = 0;
  if (dif == 0) {
    ans = cal(0, 0);
    ansset.insert(ans);
  }
  int i = 1;
  for (i = 1; i < n; i++) {
    c[i - 1]--;
    if (lastdir == 0) {
      laststop++;
      if (laststop == n) {
        laststop -= 2;
        lastdir = 1;
      }
    } else {
      laststop--;
      if (laststop == -1) {
        laststop += 2;
        lastdir = 0;
      }
    }
    c[laststop]++;
    if (!match[i - 1] && c[i - 1] == b[i - 1]) {
      match[i - 1] = true;
      dif--;
    }
    if (!match[laststop] && c[laststop] == b[laststop]) {
      match[laststop] = true;
      dif--;
    }
    if (match[i - 1] && c[i - 1] != b[i - 1]) {
      match[i - 1] = false;
      dif++;
    }
    if (match[laststop] && c[laststop] != b[laststop]) {
      match[laststop] = false;
      dif++;
    }
    if (dif == 0) {
      ans = cal(0, i);
      if (ansset.find(ans) == ansset.end()) ansset.insert(ans);
    }
  }
  memset(c, 0, sizeof(c));
  dir = 1, laststop = 0, lastdir = 0;
  for (int i = 0, j = n - 1; i < m; i++) {
    if (dir == 0) {
      if (i == m - 1) {
        laststop = j;
        lastdir = 0;
      }
      c[j++]++;
      if (j == n) {
        j -= 2;
        dir = 1;
      }
    } else {
      if (i == m - 1) {
        laststop = j;
        lastdir = 1;
      }
      c[j--]++;
      if (j == -1) {
        j += 2;
        dir = 0;
      }
    }
  }
  memset(match, 0, sizeof(match));
  dif = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] == c[i])
      match[i] = true;
    else
      dif++;
  }
  if (dif == 0) {
    ans = cal(1, n - 1);
    ansset.insert(ans);
  }
  i = n - 2;
  for (i = n - 2; i >= 0; i--) {
    c[i + 1]--;
    if (lastdir == 0) {
      laststop++;
      if (laststop == n) {
        laststop -= 2;
        lastdir = 1;
      }
    } else {
      laststop--;
      if (laststop == -1) {
        laststop += 2;
        lastdir = 0;
      }
    }
    c[laststop]++;
    if (!match[i + 1] && c[i + 1] == b[i + 1]) {
      match[i + 1] = true;
      dif--;
    }
    if (!match[laststop] && c[laststop] == b[laststop]) {
      match[laststop] = true;
      dif--;
    }
    if (match[i + 1] && c[i + 1] != b[i + 1]) {
      match[i + 1] = false;
      dif++;
    }
    if (match[laststop] && c[laststop] != b[laststop]) {
      match[laststop] = false;
      dif++;
    }
    if (dif == 0) {
      ans = cal(1, i);
      if (ansset.find(ans) == ansset.end()) ansset.insert(ans);
    }
  }
  if (ansset.size() != 1)
    cout << -1 << endl;
  else
    cout << *ansset.begin() << endl;
}
