public class Banknoty {

static int max_n = 200;

static int max_k = 20000;

static int nieskonczonosc = 1000000000;

static int n;

static int []b = new int[max_n+1];

static int []c = new int[max_n+1];

static int k;

static int []R = new int[max_k+1];

static int []M = new int[max_k+1];

static int [][]W = new int[max_k+1][max_n+1];

public static void main(String[] args){

StreamTokenizer strTok = new StreamTokenizer(

new BufferedReader(

new InputStreamReader(System.in)

)

);

try{

strTok.nextToken();

n = (int)strTok.nval;

for(int i = 0; i < n; i++){

strTok.nextToken();

b[i] = (int)strTok.nval;

}

for(int i = 0; i< n; i++){

strTok.nextToken();

c[i] = (int)strTok.nval;

}

strTok.nextToken();

k = (int)strTok.nval;

}catch (IOException e) {

System.err.println("Input Stream ERROR");

}

szukaj();

odpowiedz();

}

static void szukaj(){

R[0] = 0;

for(int i = 1; i < k+1; i++){

R[i] = nieskonczonosc;

}

LinkedList Q = new LinkedList();

for(int i = 0; i < n; i++){

for(int r = 0; r< b[i]; r++){

Q.clear();

int l = 0;

while((r+(l*b[i])) <= k){

M[l] = R[r + (l*b[i])] - l;

while(!Q.isEmpty() && M[Q.getLast()] >= M[l]){

Q.removeLast();

}

Q.addLast(l);

R[r+(l*b[i])] = M[Q.getFirst()] + l;

W[i][r+(l*b[i])] = l - Q.getFirst();

if(Q.getFirst() == l - c[i]){

Q.removeFirst();

}

l = l + 1;

}

}

}

}

static void odpowiedz(){

int j = k;

for(int i = n-1; i>=0; i--){

System.out.println("Wyplac "+ W[i][j]+" banknotow o nominale "+ b[i]);

j = j - (W[i][j]*b[i]);

}

}

}