#include <bits/stdc++.h>   using namespace std;   int n, m, a[100001], q, sum;   int b[1000001];   int main() {     int n, m, q, sum = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       b[a[i] + sum] = i;       b[1 + sum] = i;       sum += a[i];     }     cin >> m;     for (int j = 1; j <= m; j++) {       cin >> q;       if (b[q]) {         cout << b[q] << endl;         continue;       }       for (int k = 1; k <= 1000; k++) {         if (b[q + k]) {           cout << b[q + k] << endl;           break;         }         if (b[q - k]) {           cout << b[q - k] << endl;           break;         }       }     }     return 0;   }   