import math p,q,r = map(int,input().split()) a,b,c = map(int,input().split()) n_min = p*(a-1)+1 n_max = p*a while 1: n_min += 1 if math.ceil(n_min/q) - a == b and math.ceil(n_min/r) - (a+b) == c: break while 1: n_max -= 1 if math.ceil(n_max/q) - a == b and math.ceil(n_max/r) - (a+b) == c: break print(n_min,n_max)