#include using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) #define DEBUG #define int long long #define INF 1e18 template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template ostream& operator << (ostream &s, pair P) { return s << '<' << P.first << ", " << P.second << '>'; } template ostream& operator << (ostream &s, vector P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template ostream& operator << (ostream &s, vector > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template ostream& operator << (ostream &s, set P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template ostream& operator << (ostream &s, map P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } templatevoid show(vectorv){for (int i = 0; i < v.size(); i++){cerr<>n; vectora(n); for (int i = 0; i < n; i++) { cin>>a[i]; } int cnt=0; vectorr,qq; mapmp; int c; int idx; for (int i = 0; i <= n; i++) { int s=cnt%n; if(mp[s]!=0){ c=s; idx=i; qq.push_back(cnt); r.push_back(s); break; } qq.push_back(cnt); mp[s]++; r.push_back(s); cnt+=a[s]; } int id; for (int i = 0; i < n; i++) { if(r[i]==c){ id=i; break; } } int syuki=idx-id; vectorb; cnt=0; for (int i = 0; i <= syuki; i++) { cnt=qq[id+i]-qq[id]; b.push_back(cnt); } // show(qq); //show(r); //show(b); //cerr<<" syuki"<>q; for (int i = 0; i < q; i++) { int k; cin>>k; if(k