P, Q, Y0, p0, q0, Y = map(int,input().split()) Y_Y0 = abs(Y - Y0) print((p0 + Y_Y0) % P , (q0 + Y_Y0) % Q)