# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline #文字列入力のときは注意 p,q,r = [int(i) for i in readline().split()] a,b,c = [int(i) for i in readline().split()] def f(a,p): return ((a-1)*p+1, a*p) l1,r1 = f(a,p) l2,r2 = f(a+b,q) l3,r3 = f(a+b+c,r) #print(f(a,p), f(a+b,q),f(a+c,r)) if max(0, min(r1,r2,r3) - max(l1,l2,l3))==0: print(-1) else: print(max(l1,l2,l3),min(r1,r2,r3))