def get_howmany(step, hm_phonotactics_ceiling, hm_paths_ceiling):
    """
    Called by loanpy.adrc.Adrc.adapt and loanpy.sanity.eval_one. \
Put marbles into three pots, one by one, with following conditions: \
if the product of the number of marbles per pot is higher than step, stop. \
Don't put more marbles in pot 2 and 3 than the ceiling variables indicate. \
The idea is that loanpy.adrc.Adrc.adapt gets a parameter <howmany> that \
indicates the total number of predictions, which flows into this function's \
<step> parameter. This has to be split into three: The first is the number \
of combinations to get from phoneme substitutions. The second the \
maximum number of combinations from the number of different \
phonotactic structures \
chosen, to which to adapt. The third the number of paths through which each \
structure can be be reached. So if 100 predictions should be made for a word \
but not pick more than 2 structures to which to adapt and 2 paths through \
which to reach those structures, 25 predictions have to be made from \
sound substitutions for 2 times 2 different paths to make 100 predictions. \
The loop breaks *after* the product is stepped over because any \
leftover will be sliced away in loanpy.adrc.Adrc.adapt.

    :param step: the product of the three pots. Stop after reached.
    :type step: int

    :param hm_phonotactics_ceiling: The max nr of marbles for pot 2
    :type hm_phonotactics_ceiling: int

    :param hm_paths_ceiling: The max nr of marbles for pot 3
    :type hm_paths_ceiling: int

    :returns: The way the marbles should be split
    :rtype: (int, int, int)

    :Example:

    >>> from loanpy.helpers import get_howmany
    >>> get_howmany(10, 2, 2)
    (3, 2, 2)  # since 3*2*2=12, superfluous 2 will be sliced away later
    >>> get_howmany(100, 9, 2)
    (8, 7, 2)  # since 8*7*2=112, superfluous 12 will be sliced away later

    """
    if hm_phonotactics_ceiling == 0:
        return step, hm_phonotactics_ceiling, hm_paths_ceiling

    x, y, z = 1, 1, 1
    while x*y*z < step:
        x += 1
        if x*y*z >= step:
            return x, y, z
        if y < hm_phonotactics_ceiling:
            y += 1
            if x*y*z >= step:
                return x, y, z
        if z < hm_paths_ceiling:
            z += 1
            if x*y*z >= step:
                return x, y, z

    return x, y, z