def determine_molecule_numbers(total, molecules, absolute, relative):
    """Determine molecule numbers for given total, 
    absolute and relative numbers""" 
    weight = sum(relative)
    if not any(absolute):
        # Only relative numbers
        numbers = [int(total*i/weight) for i in relative]
    elif any(relative):
        # Absolute numbers and fill the rest with relative numbers
        rest = total - sum(absolute)
        numbers = [int(rest*i/weight) if i else j 
                   for i,j in zip(relative, absolute)]
    else:
        # Only absolute numbers
        numbers = absolute
    return list(zip(molecules, numbers))