P, Q, Yo, po, qo, Y = map(int, input().split()) if Yo Y: #ansP = (Y -Yo)%P + po #ansQ = (Y -Yo)%q + qo print(ansp, ansq)