Sum[DirichletCharacter[8, 1, i] PowerMod[i, -2, 8], {i, 1, 8}]