package main

import . "fmt" 
import . "math/rand"

func main() {
	var a,b,c,d,n,p,q,r,s,t int
	Scan(&a,&b,&c,&d,&n,&p,&q,&r,&s,&t)
	var w,x,y,z int
	for {
		h:=w*p+x*q+y*r+z*s
		if h==t {
			Println(w,x,y,z)
			return
		}
		g:=Intn(4)
		if h<t {
			switch {
				case g==0&&w<a:
				w++
				case g==1&&x<b:
				x++
				case g==2&&y<c:
				y++
				case g==3&&z<d:
				z++
			}
		} else {
			switch {
				case g==0&&w>0:
				w--
				case g==1&&x>0:
				x--
				case g==2&&y>0:
				y--
				case g==3&&z>0:
				z--
			}
		}
	}
}