Stable version for shadow computation