#include <bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define lep( i, l, r ) for ( int i = ( l ); i <= ( r ); i ++ )
#define rep( i, r, l ) for ( int i = ( r ); i >= ( l ); i -- )
#define gep( i, x ) for ( int i = head[( x )]; i; i = edges[i].next)
char _c; bool _f; template < class T > inline void read ( T &x ) {
_f = 0, x = 0;
while ( _c = getchar (), !isdigit (_c) ){
if ( _c == '-' ) { _f = 1; }
}
while ( isdigit (_c) ){
x = x * 10 + _c - '0', _c = getchar ();
if (_f) { x = -x; }
}
}
const int N = 305;
const int M = 1e7 + 5;
const int INF = 1e8;
int n, m, mc, day, cnt;
int a[N], w[N], c[N], f[N][N];
struct Node {
int f, l, d;
};
struct Node2 {
int f, d;
}p[M];
#define PII pair < int, int >
map < PII, int > mp;
queue < Node > q;
void bfs () {
q.push ( { 1, 0, 1 } );
while ( !q.empty () ) {
Node x = q.front ();
q.pop ();
p[++ cnt] = { x.f, x.d };
if ( x.d == day ) {
continue;
}
if ( x.l && x.f * x.l <= INF && !mp[PII ( x.f * x.l, x.l )] ) {
q.push ( { x.f * x.l, x.l, x.d + 1 } );
mp[PII ( x.f * x.l, x.l ) ] = x.d;
}
if ( !mp[PII ( x.f, x.l + 1 )] ) {
q.push ( { x.f, x.l + 1, x.d + 1 } );
mp[PII ( x.f, x.l + 1 )] = x.d;
}
}
}
bool Check ( int x ) {
if ( x <= day ) {
return true;
}
int pos = 0;
rep ( i, cnt, 1 ) {
if ( p[i].f <= x && p[i].d <= day && x - p[i].f <= day - p[i].d ) {
return true;
}
while ( pos < cnt && p[i].f + p[pos + 1].f <= x ) {
pos ++;
if ( p[i].f - p[i].d + p[pos].f - p[pos].d + day >= x ) {
return true;
}
}
}
return false;
}
bool cmp ( Node2 x, Node2 y ) {
return x.f < y.f;
}
signed main () {
ios :: sync_with_stdio ( false );
cin.tie ( 0 ), cout.tie ( 0 );
cin >> n >> m >> mc;
lep ( i, 1, n ) {
cin >> a[i];
}
lep ( i, 1, n ) {
cin >> w[i];
}
lep ( i, 1, m ) {
cin >> c[i];
}
memset ( f, 0xcf, sizeof ( f ) );
f[0][mc] = 0;
lep ( i, 1, n ) {
lep ( j, a[i], mc ) {
f[i][j - a[i]] = max ( f[i][j - a[i]], f[i - 1][j] + 1 );
f[i][min ( j - a[i] + w[i], mc )] = max ( f[i][min ( j - a[i] + w[i], mc )], f[i - 1][j] );
}
}
lep ( i, 1, n ) {
lep ( j, 0, mc ) {
day = max ( day, f[i][j] );
}
}
bfs ();
sort ( p + 1, p + 1 + cnt, cmp );
lep ( i, 1, m ) {
if ( Check ( c[i] ) ) {
cout << 1 << '\n';
}
else {
cout << 0 << '\n';
}
}
return 0;
}