from typing import Callable


def required_fuel(crabs: list[int], cost: Callable[[list[int], int], int]) -> int:
    """
    Calculates the minimum required fuel for crabs to move given a cost function
    """
    position_range = range(min(crabs), max(crabs) + 1)
    assert len(position_range) > 0
    return min(cost(crabs, target) for target in position_range)