#include <iostream>
using namespace std;
typedef long long int ll;
int main() {
// your code goes here
ll n;
cin>>n;
ll a[n+1];
ll i;
for(i=1;i<=n;i++)
{
cin>>a[i];
}
ll dp[n+1]={0};
dp[1]=a[1]; //base case
dp[2]=a[1]+ a[2];
i=3;
while(i<=n)
{
dp[i]=dp[i-1]+a[i]; //0(N) time to cal all dp values
i++;
}
ll q;
cin>>q;
i=1;
while(i<=q) //0(Q)
{
ll index;
cin>>index;
cout<<dp[index]; //0(1)
cout<<"\n";
i++;
}
// tc-0(N+Q)
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBpbnQgbGw7CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCQoJbGwgbjsKCWNpbj4+bjsKCWxsIGFbbisxXTsKCWxsIGk7Cglmb3IoaT0xO2k8PW47aSsrKQoJIHsKCSAJY2luPj5hW2ldOyAgICAgICAgICAgCgkgfQoJIAoJIGxsIGRwW24rMV09ezB9OwoJIAoJIGRwWzFdPWFbMV07ICAgLy9iYXNlIGNhc2UKIAkgZHBbMl09YVsxXSsgYVsyXTsKCSAKCSBpPTM7Cgkgd2hpbGUoaTw9bikKCSAgewoJICAJCgkgIAlkcFtpXT1kcFtpLTFdK2FbaV07ICAgIC8vMChOKSB0aW1lIHRvIGNhbCBhbGwgZHAgdmFsdWVzCgkgIAlpKys7CgkgIH0KCSAgCgkgIGxsIHE7CgkgIGNpbj4+cTsKCSAgaT0xOwoJICB3aGlsZShpPD1xKSAgICAgICAvLzAoUSkKCSAgIHsKCSAgIAkgbGwgaW5kZXg7CgkgICAJIGNpbj4+aW5kZXg7CgkgICAJIGNvdXQ8PGRwW2luZGV4XTsgIC8vMCgxKQoJICAgCSBjb3V0PDwiXG4iOwoJICAgCSBpKys7CgkgICB9CgkgICAKCSAgIC8vIHRjLTAoTitRKQoJCglyZXR1cm4gMDsKfQ==