p,q,r = map(int,input().split()) a,b,c = map(int,input().split()) n = [] ans = [] for num in range(a*p,a*(p+1)): if num%q == 0: num_b = num//q else: num_b = num//q + 1 if num_b - a == b: n.append(num) for i in range(len(n)): num = n[i] if num%r == 0: num_c = num//r else: num_c = num//r + 1 if num_c - (a+b) == c: ans.append(num) print(ans[0],ans[-1])