```python
def line_cost(price: int, quantity: int) -> int:
    """
    Returns the cost of a single line: unit price times quantity.
    """
    if price < 0 or quantity < 0:
        raise ValueError("Price and quantity must be non-negative.")
    return price * quantity

def basket_cost(lines: list, discount: int) -> int:
    """
    Adds up every line and then takes off a whole-percent discount, rounding what is left down to whole pence.
    An empty basket costs nothing.
    """
    if not lines:
        return 0
    total_cost = sum(line_cost(price, quantity) for price, quantity in lines)
    if discount > 100:
        raise ValueError("Discount must be less than or equal to 100.")
    discounted_cost = total_cost * (100 - discount) / 100
    return round(discounted_cost)
```