def METHOD_NAME(formula: sympy.Basic) -> bool:
    if isinstance(
        formula, (sympy.Symbol, sympy.Integer, sympy.Float, sympy.Rational, sympy.NumberSymbol)
    ):
        return True
    if isinstance(formula, (sympy.Add, sympy.Mul)):
        return all(METHOD_NAME(f) for f in formula.args)
    return False