**How to reproduce**
```
SELECT
    intervalLengthSum(10, 5) AS res,
    toInt64(res) AS cast,
    toTypeName(res) AS type

Query id: bc8307c2-a520-4499-959e-bb00e0bdf055

┌──────────────────res─┬─cast─┬─type───┐
│ 18446744073709551611 │   -5 │ UInt64 │
└──────────────────────┴──────┴────────┘
```
**Expected behavior**
intervals with negative sum will be converted to zero.
{
        if (!sorted)
        {
            std::sort(std::begin(segments), std::end(segments));
            sorted = true;
        }
    }
    void serialize(WriteBuffer & buf) const