library SafeMath {
    /**
     * @dev Performs addition.
     * @param a first number
     * @param b second number
     * @return c addtion
     */
    function add(uint a, uint b) internal pure returns (uint c) {
        c = a + b;
        require(c >= a && c >= b);
    }

    /**
     * @dev Performs subtraction.
     * @param a first number
     * @param b second number, must be less or equal to a
     * @return c difference
     */
    function sub(uint a, uint b) internal pure returns (uint c) {
        require(b <= a);
        c = a - b;
    }

    /**
     * @dev Performs multiplication.
     * @param a first number
     * @param b second number
     * @return c addtion
     */
    function mul(uint a, uint b) internal pure returns (uint c) {
        c = a * b;
        require(a == 0 || c / a == b);
    }

    /**
     * @dev Performs division.
     * @param a first number
     * @param b second number, cannot be 0
     * @return c addtion
     */
    function div(uint a, uint b) internal pure returns (uint c) {
        require(b > 0);
        c = a / b;
    }

}
/**
 * @title Math operations with safety checks for overflows.
 */
function mul(uint a, uint b) internal pure returns (uint c) {
    c = a * b;
    require(a == 0 || c / a == b);
}

/**
 * @dev Performs multiplication.
 * @param a first number
 * @param b second number
 * @return c addtion
 */