@staticmethod
def is_in_interval(n, l, r, border='included'):
    """
        Checks whether a number is inside the interval l, r.
        """
    if 'included' == border:
        return n >= l and n <= r
    elif 'excluded' == border:
        return n > l and n < r
    else:
        raise ValueError("borders must be either 'included' or 'excluded'")
