def from_bcd(val: int) -> int:
    """Convert BCD encoded number to decimal.

    Args:
        val: BCD encoded number.
    Returns:
        Decimal value.
    """
    return val % 16 + (val >> 4) * 10