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