#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const int mod = 9999997;
int n, m;
int a[maxn];
int b[maxn];
int c[maxn];
void input()
{
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", &c[i]);
b[c[i]] = 1;
}
}
void solve()
{
register int s = 1;
for(int i = 1; i <= n; ++i)
if(!b[i]) s = (long long)s * (a[i] + 1) % mod;
register int ans = (s - 1 + mod) % mod;
for(int i = 1; i <= m; ++i)
ans = (ans + (long long)a[c[i]] * s) % mod;
printf("%d\n", ans);
}
int main()
{
freopen("Marshtomp.in", "r", stdin);
freopen("Marshtomp.out", "w", stdout);
input();
solve();
fclose(stdin);
fclose(stdout);
return 0;
}