import math


def fuel_counter(masses):
    """Function that computes the fuel needed for the input masses.
    Expected input is required to either be a list/tuple or scalar"""
    if isinstance(masses, (tuple, list)):
        return sum(fuel_counter(mass) for mass in masses)
    return max(int(math.floor(masses / 3) - 2), 0)