library SafeMath{
    // Multiples 2 numbers, throws on overflow is detected.
    function mul(uint256 _x, uint256 _y) internal pure returns (uint256 result){
        if(_y == 0){
            return 0;
        }
        result = _x*_y;
        assert(_x == result/_y);
        return result;
    }
    //Divides 2 numbers, solidity automatically throws if _y is 0.
    function div(uint256 _x, uint256 _y) internal pure returns (uint256 result){
        result = _x / _y;
        return result;
    }
    //Adds 2 numbers, throws on overflow.
    function add(uint256 _x, uint256 _y) internal pure returns (uint256 result){
        result = _x + _y;
        assert(result >= _x);
        return result;
    }
    function sub(uint256 _x, uint256 _y) internal pure returns (uint256 result){
        assert(_x >= _y);
        result = _x - _y;
        return result;
    }
}
function add(uint256 _x, uint256 _y) internal pure returns (uint256 result){
    result = _x + _y;
    assert(result >= _x);
    return result;
}

//Adds 2 numbers, throws on overflow.