#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; if(lt < 0 && ln < 0) break; // x+y = ln; swap(t,s); swap(s,r); // sx+ty = lt; // sx+sy = s*ln; // y = (lt-s*ln)/(t-s) // x = ln-y int y = (lt-s*ln)/(t-s); int x = ln-y; if(y*(t-s) != (lt-s*ln) || y < 0 || x < 0 || y > d || x > c){ swap(s,r); swap(t,s); continue; } cout<