Bug 1 Algorithm Working with Domain 2