P, Q, Y0, p0, q0, Y = map(int, input().split()) d = Y -Y0 s1, p = divmod(p0 + d, P) s1, q = divmod(q0 + d, Q) print(p, q)