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

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

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
    c = a + b;
    require(c >= a, "SafeMath add failed");
    return c;
  }
}
/**
 * @title SafeMath from OpenZeppelin
 * @dev Math operations with safety checks that throw on error
 * Changes:
 * - changed asserts to require with error log
 * - removed div
 */
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
  if (a == 0) {
    return 0;
  }
  c = a * b;
equire(c / a == b, "SafeMath mul failed");
  return c;
}

/**
 * @dev Multiplies two numbers, throws on overflow.
 */