#include #include using namespace std; long P,Q,R,A,B,C; long l,r; main() { l=-1; r=1e18; cin>>P>>Q>>R>>A>>B>>C; l=max(l,P*(A-1)+1); r=min(r,P*A); l=max(l,Q*(A+B-1)+1); r=min(r,Q*(A+B)); l=max(l,R*(A+B+C-1)+1); r=min(r,R*(A+B+C)); if(l<=r)cout<