modified Fesistel for logic errors when computing R