Agero interview question

Derive a mathematical formula for a given scenario and then write a pseudo code