integer a,b,c,d,e,f,n_a,i,j,k,l,S,T
double precision youeki, yousitu,noudo,Li

read*, a,b,c,d,e,f
noudo=0
Li=0;n=int(f/(100*a))

do i=0, 5+n_a
  do j=0, 5+int((f-100*i*a)/(100*b))
    do k=0, 5+int((f-100*i*a-100*j*b-k*c)/d)
      do l=0, 5+int((f-100*i*a-100*j*b-k*c)/d)
        S=100*a*i+100*b*j+c*k+d*l
        T=c*k+d*l
        if(S==0)cycle
        Li=100.0*T/S
        if (S<=f .and. Li<=100.0*e/(100.0+e) .and. Li>=noudo) then
          noudo=Li
          youeki=S
          yousitu=T
        endif
     end do
   end do
  end do
end do
print"(i0,A,i0)", int(youeki)," ",int(yousitu)
end