#include <bits/stdc++.h>
using namespace std;
template<class T>inline void Read(T &x)
{
int f = 1;
char t = getchar();
while (t < '0' || t > '9') {
if (t == '-') f = -1;
t = getchar();
}
x = 0;
while (t >= '0' && t <= '9') {
x = x * 10 + t - '0';
t = getchar();
}
x *= f;
}
const int maxn = 100005;
const int modulo = 9999997;
int n, m, ln;
int A[maxn], B[maxn];
bool ban[maxn];
long long ans = 1, en;
void input()
{
int x;
Read(n);
for (register int i = 1; i <= n; i++) Read(A[i]);
Read(m);
for (register int i = 1; i <= m; i++) Read(x), ban[x] = true;
for (register int i = 1; i <= n; i++) if (!ban[i]) B[++ln] = A[i];
}
void solve()
{
for (register int i = 1; i <= ln; i++) ans = 1ll * ans * (B[i] + 1) % modulo;
en = ans;
for (register int i = 1; i <= n; i++) {
if (ban[i]) {
ans = (ans + 1ll * en * A[i]) % modulo;
}
}
ans = (ans - 1 + modulo) % modulo;
cout << ans << endl;
}
int main()
{
freopen("Marshtomp.in", "r", stdin);
freopen("Marshtomp.out", "w", stdout);
input();
solve();
fclose(stdin);
fclose(stdout);
return 0;
}