import math


def compute_fuel_mass(mass: int) -> int:
    """
    Computes the fuel required for a specific mass, taking
    into account that the fuel has mass itself.
    """
    # Stopping condition
    if mass <= 0:
        return 0

    fuel = (math.floor(mass/3)-2)
    fuel = fuel if fuel > 0 else 0

    return fuel + compute_fuel_mass(fuel)