P, Q, Yo, po, qo, Y = map(int, input().split()) poo = Yo%P +po qoo = Yo%Q + qo ansp = (abs(Y - poo))%P ansq = (abs(Y - qoo))%q print(ansp, ansq)