Implements Queue math