solve for d where n = (d + 7) mod 10