computing an averague with the valid neighbors if a not valid value is detected