Sort:  

I think that it is this:

result = ( ( rshares + s ) * ( rshares + s ) - s * s ) / ( rshares + 4 * s )

where s is 2,000,000,000,000 (i.e. 2e12).