import math
from functools import reduce
from operator import mul


def calc_mats(runs, quantity, me_bonuses):
    """
    Calculate material requirement for one material in a manufacturing job.

    :param runs: Number of runs in the job.
    :param quantity: Raw quantity of a material required for one run.
    :param me_bonuses: List of factors influencing material efficiency. This
           may include blueprint ME research (1% per level) and/or facility
           bonus used as a bonus of the job's build material requirements.
           Factors should be represented as a percent bonus (e.g. 5%
           reduction in material requirements appears in the list as 5 and a
           5% increase in material requirements appears as -5).
    :return: number of the material required for the job
    """
    if not isinstance(me_bonuses, list):
        me_bonuses = [me_bonuses]

    factors = [runs, quantity] + [1 - (float(x) / 100.0) for x in me_bonuses]
    return max(runs, math.ceil(reduce(mul, factors, 1)))