#include #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)n;++i) #define each(a, b) for(auto (a): (b)) #define all(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define show(x) cout <<#x<<" = "<<(x)<P; typedef complexC; const int MAX_N = 100005; const double PI = 4*atan(1.0); //aにはAiおよびBi(係数)が入っている vector FFT(double theta, const vector& a){ int n = (int)a.size(); vector ret = a; for(int m=n; m>=2; m>>=1){ int mh = m>>1; rep(i,mh){ C w = exp(i*theta*C(0,1)); for(int j=i; j>1; k>(i^=k); k>>= 1){ } if(j < i) swap(ret[i], ret[j]); } return ret; } //畳み込み template vector Convolution(const vector &lhs, const vector &rhs){ int n = 1; while(n <= (int)(lhs.size() + rhs.size())){ n <<= 1; } vector temp1(n); vector temp2(n); for(int i=0; i ret(n); rep(i,n){ ret[i] = (T)(temp1[i].real()/n + 0.5); //T=intの時用 } return ret; } int main() { int l,m,n; scanf("%d%d%d",&l,&m,&n); vector a(l),b(m); rep(i,l){ scanf("%d",&a[i]); } rep(i,m){ scanf("%d",&b[i]); b[i] = n-b[i]; } vector u(*max_element(all(a))+1,0); vector v(*max_element(all(b))+1,0); rep(i,l){ u[a[i]]++; } rep(i,m){ v[b[i]]++; } vector res = Convolution(u,v); int q; scanf("%d",&q); rep(i,q){ if(n+i < res.size()){ printf("%d\n",res[n+i]); }else{ printf("0\n"); } } }