def max(a, b): return a if a >= b else b def min(a, b): return a if a <= b else b pqr_list = list(map(int,input().split())) abc_list = list(map(int,input().split())) p, q, r = pqr_list a, b, c = abc_list gold_range = [(a-1) * p, a * p] silver_range = [(a+b-1) * q, (a+b) * q] bronze_range = [(a+b+c-1) * r, (a+b+c) * r] gs_range = [0] * 2 gsb_range = [0] * 2 res = [] if gold_range[0] < silver_range[1] and silver_range[0] < gold_range[1]: gs_range[0] = max(gold_range[0], silver_range[0]) gs_range[1] = min(gold_range[1], silver_range[1]) if gs_range[0] < bronze_range[1] and bronze_range[0] < gs_range[1]: gsb_range[0] = max(gs_range[0], bronze_range[0]) gsb_range[1] = min(gs_range[1], bronze_range[1]) if gsb_range[0] + 1 == gsb_range[1]: res.append(gsb_range[1]) else: res.append(gsb_range[0]) res.append(gsb_range[1]) else: res.append(-1) else: res.append(-1) if len(res) == 1: print(res[0]) else: print('{} {}'.format(res[0] + 1, res[1]))