library SafeMathUint8 {
    /**
    * @dev Multiplies two numbers, throws on overflow.
    */
    function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
        if (a == 0) {
            return 0;
        }
        c = a * b;
        require(c / a == b, "SafeMath: Multiplier exception");
        return c;
    }

    /**
    * @dev Integer division of two numbers, truncating the quotient.
    */
    function div(uint8 a, uint8 b) internal pure returns (uint8) {
        return a / b; // Solidity automatically throws when dividing by 0
    }

    /**
    * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint8 a, uint8 b) internal pure returns (uint8) {
        require(b <= a, "SafeMath: Subtraction exception");
        return a - b;
    }

    /**
    * @dev Adds two numbers, throws on overflow.
    */
    function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
        c = a + b;
        require(c >= a, "SafeMath: Addition exception");
        return c;
    }

    /**
    * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
    * reverts when dividing by zero.
    */
    function mod(uint8 a, uint8 b) internal pure returns (uint8) {
        require(b != 0, "SafeMath: Modulo exception");
        return a % b;
    }

}
/**
 * @title SafeMath for uint8
 * @dev Math operations with safety checks that throw on error
 */
function div(uint8 a, uint8 b) internal pure returns (uint8) {
    return a / b; // Solidity automatically throws when dividing by 0
}

/**
 * @dev Integer division of two numbers, truncating the quotient.
 */