Resource cost estimation

Hi,

I have a question on estimating resource. It may be a silly question.

How resource cost is estimated ? I saw resource calculator.
But on what basis cost is estimated?
Ex. to buy 10bytes of RAM, it say cost is 0.00060073 EOS. How that number was calculated? Where is the formula and where is the implementation?

Thanks