#include using namespace std; #define int long long signed main(){ int a,b,c,d,n,p,q,r,s,t; cin>>a>>b>>c>>d>>n>>p>>q>>r>>s>>t; for(int i=0;i<=a;i++)for(int j=0;j<=b;j++){ int lt = t-i*p-j*q; int ln = n-i-j; // x+y = ln; // rx+sy = lt; // sx+sy = s*ln; // y = (lt-s*ln)/(t-s) // x = ln-y int x,y; if(s == r){ x = min(c,ln); y = ln-x; } else{ y = (lt-r*ln)/(s-r); x = ln-y; } if(i*p+j*q+x*r+y*s != t || y < 0 || x < 0 || y > d || x > c){ continue; } cout<