p,q,r = map(int,input().split()) gold,sil,bro = map(int,input().split()) gold_l = (gold-1)*p+1#金の情報だけで推測できるNの最小値 gold_r = gold*p#最大値 #print(gold_l,gold_r) sil_l = (sil+gold-1)*q+1 sil_r = (sil+gold)*q #print(sil_l,sil_r) bro_l = (bro+gold+sil-1)*r+1 bro_r = (bro+gold+sil)*r if bro_l > max(sil_r,gold_r) or bro_r < min(gold_l,sil_l): print(-1) else: print(bro_l,bro_r)