let n = readLine()!.split(separator: " ").map{Int($0)!} let m = readLine()!.split(separator: " ").map{Int($0)!} let (P,Q,R) = (n[0],n[1],n[2]) let (A,B,C) = (m[0],m[1],m[2]) let x = Int([(A-1)*P+1,(A+B-1)*Q+1,(A+B+C-1)*R+1].max()!) let y = Int([A*P,(A+B)*Q,(A+B+C)*R].min()!) if x > y{ print(-1) }else{ print(x , y) }