//D
#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,z,t,k,op,ans=0;
int a[610];
int main()
{
	freopen("match.in","r",stdin);
	freopen("match.out","w",stdout);
	int i,j;
	cin>>t>>n;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&x);
		k=max(k,x);
	}
	
	for(i=1;i<=n;i++)
	{
		scanf("%d",&x);
		op=max(op,x);
	}
	
	cin>>t;
	while(t--)
	{
		printf("%d\n",t*k*op);
	}
	return 0;
}