#include #include #include using namespace std; int main(void){ int N,Q; string S; long long K; cin >> N >> S; vector A(N,0); //↓i個倒した時のやつ vector cnt(N+1,0); for(int i=0;i> A[i]; if(i>0)A[i]+=A[i-1]; } cin >> Q; for(int i=0;i> K; auto it=upper_bound(A.begin(),A.end(),K); cout << cnt[distance(A.begin(),it)] << endl; } return 0; }