Solved problem with restriction based on division